Skip to content

Commit

Permalink
Bug 1882127 - Add js::NewFunctionByIdWithReservedWithProto. r=jandem
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D202820

UltraBlame original commit: f537b9d36bb279bfe2949345fdb042f8e07f0575
  • Loading branch information
marco-c committed Jun 6, 2024
1 parent baef9ab commit 27760c1
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 0 deletions.
121 changes: 121 additions & 0 deletions js/src/jsfriendapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2748,6 +2748,127 @@ 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
&
Expand Down
27 changes: 27 additions & 0 deletions js/src/jsfriendapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,33 @@ id
)
;
JS_PUBLIC_API
JSFunction
*
NewFunctionByIdWithReservedAndProto
(
JSContext
*
cx
JSNative
native
JS
:
:
Handle
<
JSObject
*
>
proto
unsigned
nargs
unsigned
flags
jsid
id
)
;
JS_PUBLIC_API
const
JS
:
Expand Down

0 comments on commit 27760c1

Please sign in to comment.