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

Function gjs_load_internal_source

gjs/engine.cpp:80–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80bool gjs_load_internal_source(JSContext* cx, const char* filename, char** src,
81 size_t* length) {
82 Gjs::AutoError error;
83 const char* path = filename + 11; // len("resource://")
84 GBytes* script_bytes =
85 g_resources_lookup_data(path, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
86 if (!script_bytes)
87 return gjs_throw_gerror_message(cx, error);
88
89 *src = static_cast<char*>(g_bytes_unref_to_data(script_bytes, length));
90 return true;
91}
92
93class GjsSourceHook : public js::SourceHook {
94 bool load(JSContext* cx, const char* filename,

Callers 3

gjs_load_internal_moduleFunction · 0.85
run_bootstrapMethod · 0.85
loadMethod · 0.85

Calls 1

gjs_throw_gerror_messageFunction · 0.85

Tested by

no test coverage detected