MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / defineGlobal

Function defineGlobal

src/internalBinding/utils.cc:25–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 */
24
25static bool defineGlobal(JSContext *cx, unsigned argc, JS::Value *vp) {
26 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
27 JS::HandleValue nameVal = args.get(0);
28 JS::HandleValue value = args.get(1);
29 args.rval().setUndefined();
30
31 JS::RootedObject globalObj(cx, JS::CurrentGlobalOrNull(cx));
32 JS::RootedId name(cx);
33
34 return JS_ValueToId(cx, nameVal, &name) &&
35 JS_DefinePropertyById(cx, globalObj, name, value, 0); // Object.defineProperty(obj, name, { value })
36}
37
38static bool isAnyArrayBuffer(JSContext *cx, unsigned argc, JS::Value *vp) {
39 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected