MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_context_setup_debugger_console

Function gjs_context_setup_debugger_console

gjs/debugger.cpp:129–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127 JS_FS_END};
128
129void gjs_context_setup_debugger_console(GjsContext* self) {
130 auto* gjs = GjsContextPrivate::from_object(self);
131 JSContext* cx = gjs->context();
132
133 JS::RootedObject debugger_global(
134 cx, gjs_create_global_object(cx, GjsGlobalType::DEBUGGER));
135
136 // Enter realm of the debugger and initialize it with the debuggee
137 JSAutoRealm ar(cx, debugger_global);
138 JS::RootedObject debuggee{cx, gjs->global()};
139 if (!JS_WrapObject(cx, &debuggee)) {
140 gjs_log_exception(cx);
141 return;
142 }
143
144 JS::RootedValue v_debuggee(cx, JS::ObjectValue(*debuggee));
145 if (!JS_SetPropertyById(cx, debugger_global, gjs->atoms().debuggee(),
146 v_debuggee) ||
147 !JS_DefineFunctions(cx, debugger_global, debugger_funcs) ||
148 !gjs_define_global_properties(cx, debugger_global,
149 GjsGlobalType::DEBUGGER, "GJS debugger",
150 "debugger"))
151 gjs_log_exception(cx);
152}

Callers 1

mainFunction · 0.85

Calls 5

gjs_create_global_objectFunction · 0.85
gjs_log_exceptionFunction · 0.85
contextMethod · 0.80
globalMethod · 0.80

Tested by

no test coverage detected