Bug 1767829 - Part 4: Throw an error if CreateDynamicImport returns null r=yulia
This allows derived loaders not to support dynamic import if they don't want to. Module loading for in mozJSComponentLoader will not initially support this. Differential Revision: https://phabricator.services.mozilla.com/D145491
This commit is contained in:
@@ -222,6 +222,11 @@ bool ModuleLoaderBase::HostImportModuleDynamically(
|
||||
RefPtr<ModuleLoadRequest> request = loader->CreateDynamicImport(
|
||||
aCx, uri, script, aReferencingPrivate, specifierString, aPromise);
|
||||
|
||||
if (!request) {
|
||||
JS_ReportErrorASCII(aCx, "Dynamic import not supported in this context");
|
||||
return false;
|
||||
}
|
||||
|
||||
loader->StartDynamicImport(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user