diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /js/src/jsfriendapi.cpp | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jsfriendapi.cpp')
-rw-r--r-- | js/src/jsfriendapi.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 694058f6c9..574e61248e 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -420,6 +420,23 @@ JS_PUBLIC_API JSFunction* js::NewFunctionByIdWithReserved( gc::AllocKind::FUNCTION_EXTENDED); } +JS_PUBLIC_API JSFunction* js::NewFunctionByIdWithReservedAndProto( + JSContext* cx, JSNative native, HandleObject proto, unsigned nargs, + unsigned flags, jsid id) { + MOZ_ASSERT(id.isAtom()); + MOZ_ASSERT(!cx->zone()->isAtomsZone()); + MOZ_ASSERT(native); + CHECK_THREAD(cx); + cx->check(id); + + Rooted<JSAtom*> atom(cx, id.toAtom()); + FunctionFlags funflags = (flags & JSFUN_CONSTRUCTOR) + ? FunctionFlags::NATIVE_CTOR + : FunctionFlags::NATIVE_FUN; + return NewFunctionWithProto(cx, native, nargs, funflags, nullptr, atom, proto, + gc::AllocKind::FUNCTION_EXTENDED, TenuredObject); +} + JS_PUBLIC_API const Value& js::GetFunctionNativeReserved(JSObject* fun, size_t which) { MOZ_ASSERT(fun->as<JSFunction>().isNativeFun()); |