Bug 1774111 - Check for already-completed request in ModuleLoaderBase::FinishDynamicImport r=yulia
I've looked at this for a while and still don't know how this can happen but it does seem reasonable to add a check here that we haven't already completed the request. Depends on D162386 Differential Revision: https://phabricator.services.mozilla.com/D162387
This commit is contained in:
@@ -267,6 +267,9 @@ bool ModuleLoaderBase::HostPopulateImportMeta(
|
||||
bool ModuleLoaderBase::HostImportModuleDynamically(
|
||||
JSContext* aCx, JS::Handle<JS::Value> aReferencingPrivate,
|
||||
JS::Handle<JSObject*> aModuleRequest, JS::Handle<JSObject*> aPromise) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aModuleRequest);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aPromise);
|
||||
|
||||
RefPtr<LoadedScript> script(GetLoadedScriptOrNull(aCx, aReferencingPrivate));
|
||||
|
||||
JS::Rooted<JSString*> specifierString(
|
||||
@@ -945,6 +948,11 @@ void ModuleLoaderBase::FinishDynamicImport(
|
||||
// Complete the dynamic import, report failures indicated by aResult or as a
|
||||
// pending exception on the context.
|
||||
|
||||
if (!aRequest->mDynamicPromise) {
|
||||
// Import has already been completed.
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_FAILED(aResult) &&
|
||||
aResult != NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(aCx));
|
||||
|
||||
Reference in New Issue
Block a user