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

Function import_resolved

gjs/module.cpp:638–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638GJS_JSAPI_RETURN_CONVENTION
639static bool import_resolved(JSContext* cx, unsigned argc, JS::Value* vp) {
640 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
641
642 gjs_debug(GJS_DEBUG_IMPORTER, "Async import promise resolved");
643
644 Gjs::AutoMainRealm ar{cx};
645
646 g_assert(args[0].isObject());
647 JS::RootedObject module(cx, &args[0].toObject());
648
649 JS::RootedValue evaluation_promise(cx);
650 if (!JS::ModuleLink(cx, module) ||
651 !JS::ModuleEvaluate(cx, module, &evaluation_promise))
652 return fail_import(cx, args);
653
654 g_assert(evaluation_promise.isObject() &&
655 "got weird value from JS::ModuleEvaluate");
656 JS::RootedObject evaluation_promise_object(cx,
657 &evaluation_promise.toObject());
658 return finish_import(cx, evaluation_promise_object, args);
659}
660
661bool gjs_dynamic_module_resolve(JSContext* cx,
662 JS::HandleValue importing_module_priv,

Callers

nothing calls this directly

Calls 3

gjs_debugFunction · 0.85
fail_importFunction · 0.85
finish_importFunction · 0.85

Tested by

no test coverage detected