Backed out 4 changesets (bug 1877703) for causing ScriptLoader related wpt failures
Backed out changeset 6b99c1c567b4 (bug 1877703) Backed out changeset bc9c70289244 (bug 1877703) Backed out changeset 1e17b87ab7f8 (bug 1877703) Backed out changeset 591b5483bcd8 (bug 1877703)
This commit is contained in:
@@ -1097,9 +1097,18 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
|
||||
return false;
|
||||
}
|
||||
|
||||
// We cancel module preloads when registering an import map.
|
||||
MOZ_ASSERT_IF(request && request->IsModuleRequest(),
|
||||
!mModuleLoader->HasImportMapRegistered());
|
||||
if (request && request->IsModuleRequest() &&
|
||||
mModuleLoader->HasImportMapRegistered() &&
|
||||
request->mState > ScriptLoadRequest::State::Compiling) {
|
||||
// We don't preload module scripts after seeing an import map but a script
|
||||
// can dynamically insert an import map after preloading has happened.
|
||||
//
|
||||
// In the case of an import map is inserted after preloading has happened,
|
||||
// We also check if the request has started loading imports, if not then we
|
||||
// can reuse the preloaded request.
|
||||
request->Cancel();
|
||||
request = nullptr;
|
||||
}
|
||||
|
||||
if (request) {
|
||||
// Use the preload request.
|
||||
@@ -1390,16 +1399,6 @@ bool ScriptLoader::ProcessInlineScript(nsIScriptElement* aElement,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove any module preloads. Module specifier resolution is invalidated by
|
||||
// adding an import map, and incorrect dependencies may have been loaded.
|
||||
mPreloads.RemoveElementsBy([](const PreloadInfo& info) {
|
||||
if (info.mRequest->IsModuleRequest()) {
|
||||
info.mRequest->Cancel();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// TODO: Bug 1781758: Move RegisterImportMap into EvaluateScriptElement.
|
||||
//
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-element
|
||||
|
||||
Reference in New Issue
Block a user