Bug 1893164 - Make CancelImport() won't cancel a request if the URI is been waiting by other requests. r=jonco

In the following module graph:

0.html
  +---- 1.mjs
    +---- non_existing.mjs
    +---- 3.mjs
  +----- 2.mjs
    +---- 3.mjs

Both 1.mjs and 2.mjs have a common submodule called 3.mjs
But 1.mjs also has a non-existing submodule, so we can't instantiate the
module graph of 1.mjs. which in turn will cancel 3.mjs

But 3.mjs is also a sub-module of 2.mjs, so in order to instantiate the
module graph of 2.mjs, we skip canceling 3.mjs when we processed 1.mjs

Differential Revision: https://phabricator.services.mozilla.com/D209210
This commit is contained in:
Yoshi Cheng-Hao Huang
2024-05-07 16:03:20 +00:00
parent 5b06da851c
commit 3c82f6e2c6
8 changed files with 53 additions and 2 deletions

View File

@@ -1494,6 +1494,17 @@ void ModuleLoaderBase::MoveModulesTo(ModuleLoaderBase* aDest) {
mFetchedModules.Clear();
}
bool ModuleLoaderBase::IsFetchingAndHasWaitingRequest(
ModuleLoadRequest* aRequest) {
auto entry = mFetchingModules.Lookup(aRequest->mURI);
if (!entry) {
return false;
}
RefPtr<LoadingRequest> loadingRequest = entry.Data();
return !loadingRequest->mWaiting.IsEmpty();
}
#undef LOG
#undef LOG_ENABLED