| 78 | } |
| 79 | |
| 80 | bool 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 | |
| 93 | class GjsSourceHook : public js::SourceHook { |
| 94 | bool load(JSContext* cx, const char* filename, |
no test coverage detected