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

Method run_bootstrap

gjs/global.cpp:91–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 }
90
91 GJS_JSAPI_RETURN_CONVENTION
92 static bool run_bootstrap(JSContext* cx, const char* bootstrap_script,
93 JS::HandleObject global) {
94 Gjs::AutoChar uri{g_strdup_printf(
95 "resource:///org/gnome/gjs/modules/script/_bootstrap/%s.js",
96 bootstrap_script)};
97
98 JSAutoRealm ar(cx, global);
99
100 JS::CompileOptions options(cx);
101 options.setFileAndLine(uri, 1).setSourceIsLazy(true);
102
103 char* script;
104 size_t script_len;
105 if (!gjs_load_internal_source(cx, uri, &script, &script_len))
106 return false;
107
108 JS::SourceText<mozilla::Utf8Unit> source;
109 if (!source.init(cx, script, script_len,
110 JS::SourceOwnership::TakeOwnership))
111 return false;
112
113 JS::RootedValue ignored(cx);
114 return JS::Evaluate(cx, options, source, &ignored);
115 }
116
117 GJS_JSAPI_RETURN_CONVENTION
118 static bool load_native_module(JSContext* m_cx, unsigned argc,

Callers

nothing calls this directly

Calls 2

gjs_load_internal_sourceFunction · 0.85
initMethod · 0.45

Tested by

no test coverage detected