зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1803984 - Part 1: Don't use the preloaded module request if there's an import map. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D178298
This commit is contained in:
Родитель
4c07252d96
Коммит
53e105ef77
|
@ -983,6 +983,17 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there are a preloaded request and an import map, we won't use the
|
||||||
|
// preloaded request and will try to create a new one for this, because the
|
||||||
|
// import map isn't preloaded, and the preloaded request may have used the
|
||||||
|
// wrong module specifiers.
|
||||||
|
if (request && request->IsModuleRequest() &&
|
||||||
|
mModuleLoader->HasImportMapRegistered()) {
|
||||||
|
DebugOnly<bool> removed = mModuleLoader->RemoveFetchedModule(request->mURI);
|
||||||
|
MOZ_ASSERT(removed);
|
||||||
|
request = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (request) {
|
if (request) {
|
||||||
// Use the preload request.
|
// Use the preload request.
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,11 @@ nsresult ModuleLoaderBase::GetFetchedModuleURLs(nsTArray<nsCString>& aURLs) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ModuleLoaderBase::RemoveFetchedModule(nsIURI* aURL) {
|
||||||
|
MOZ_ASSERT(IsModuleFetched(aURL));
|
||||||
|
return mFetchedModules.Remove(aURL);
|
||||||
|
}
|
||||||
|
|
||||||
void ModuleLoaderBase::SetModuleFetchStarted(ModuleLoadRequest* aRequest) {
|
void ModuleLoaderBase::SetModuleFetchStarted(ModuleLoadRequest* aRequest) {
|
||||||
// Update the module map to indicate that a module is currently being fetched.
|
// Update the module map to indicate that a module is currently being fetched.
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,8 @@ class ModuleLoaderBase : public nsISupports {
|
||||||
|
|
||||||
nsresult GetFetchedModuleURLs(nsTArray<nsCString>& aURLs);
|
nsresult GetFetchedModuleURLs(nsTArray<nsCString>& aURLs);
|
||||||
|
|
||||||
|
bool RemoveFetchedModule(nsIURI* aURL);
|
||||||
|
|
||||||
// Internal methods.
|
// Internal methods.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче