Skip to content

Commit 640485e

Browse files
committed
WIP(js-debugger): define Debugger object in debuggerGlobal
1 parent 2aab6e0 commit 640485e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/modules/pythonmonkey/pythonmonkey.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ PyMODINIT_FUNC PyInit_pythonmonkey(void)
431431
return NULL;
432432
}
433433

434+
JS::RootedObject debuggerGlobal(GLOBAL_CX, JS_NewGlobalObject(GLOBAL_CX, &globalClass, nullptr, JS::FireOnNewGlobalHook, options));
435+
{
436+
JSAutoRealm r(GLOBAL_CX, debuggerGlobal);
437+
JS_DefineProperty(GLOBAL_CX, debuggerGlobal, "mainGlobal", *global, JSPROP_READONLY);
438+
JS_DefineDebuggerObject(GLOBAL_CX, debuggerGlobal);
439+
}
440+
434441
autoRealm = new JSAutoRealm(GLOBAL_CX, *global);
435442

436443
if (!JS_DefineFunctions(GLOBAL_CX, *global, jsGlobalFunctions)) {
@@ -439,14 +446,7 @@ PyMODINIT_FUNC PyInit_pythonmonkey(void)
439446
}
440447

441448
JS_SetGCCallback(GLOBAL_CX, handleSharedPythonMonkeyMemory, NULL);
442-
443-
JS::RootedObject debuggerGlobal(GLOBAL_CX, JS_NewGlobalObject(GLOBAL_CX, &globalClass, nullptr, JS::FireOnNewGlobalHook, options));
444-
{
445-
JSAutoRealm r(GLOBAL_CX, debuggerGlobal);
446-
}
447-
JS_DefineProperty(GLOBAL_CX, *global, "debuggerGlobal", debuggerGlobal, JSPROP_ENUMERATE);
448-
449-
JS_DefineDebuggerObject(GLOBAL_CX, *global);
449+
JS_DefineProperty(GLOBAL_CX, *global, "debuggerGlobal", debuggerGlobal, JSPROP_READONLY);
450450

451451
// XXX: SpiderMonkey bug???
452452
// In https://hg.mozilla.org/releases/mozilla-esr102/file/3b574e1/js/src/jit/CacheIR.cpp#l317, trying to use the callback returned by `js::GetDOMProxyShadowsCheck()` even it's unset (nullptr)

0 commit comments

Comments
 (0)