Issue #1691 - Part 4: Finish implementing call import. https://bugzilla.mozilla.org/show_bug.cgi?id=1499140

(cherry picked from commit 7bf7d64887944b127a72090dd62eb57f67c5089d)
This commit is contained in:
Brian Smith 2023-04-09 03:06:39 -05:00 committed by roytam1
commit 7a6dab0b38
35 changed files with 533 additions and 24 deletions

View file

@ -1999,15 +1999,9 @@ intrinsic_HostResolveImportedModule(JSContext* cx, unsigned argc, Value* vp)
RootedModuleObject module(cx, &args[0].toObject().as<ModuleObject>());
RootedString specifier(cx, args[1].toString());
JS::ModuleResolveHook moduleResolveHook = cx->runtime()->moduleResolveHook;
if (!moduleResolveHook) {
JS_ReportErrorASCII(cx, "Module resolve hook not set");
return false;
}
RootedObject result(cx);
RootedValue referencingPrivate(cx, JS::GetModulePrivate(module));
result = moduleResolveHook(cx, referencingPrivate, specifier);
RootedObject result(cx, CallModuleResolveHook(cx, referencingPrivate, specifier));
if (!result)
return false;