* gjs_internal_compile_module: * @uri: The URI of the module (JS string) * @source: The source text of the module (JS string) * * JS function exposed as `compileModule` in the internal global scope. * * Compiles a module source text within the main realm. * * NOTE: Modules compiled with this function can only be executed * within the main realm. * * Returns: The compiled JS module objec
| 219 | * Returns: The compiled JS module object. |
| 220 | */ |
| 221 | bool gjs_internal_compile_module(JSContext* cx, unsigned argc, JS::Value* vp) { |
| 222 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| 223 | |
| 224 | Gjs::AutoMainRealm ar{cx}; |
| 225 | |
| 226 | JS::UniqueChars uri; |
| 227 | JS::RootedString source(cx); |
| 228 | if (!gjs_parse_call_args(cx, "compileModule", args, "sS", "uri", &uri, |
| 229 | "source", &source)) |
| 230 | return handle_wrong_args(cx); |
| 231 | |
| 232 | return compile_module(cx, uri, source, args.rval()); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * gjs_internal_set_module_private: |
nothing calls this directly
no test coverage detected