| 127 | JS_FS_END}; |
| 128 | |
| 129 | void 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 | } |
no test coverage detected