summaryrefslogtreecommitdiffstats
path: root/js/loader/ModuleLoadRequest.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /js/loader/ModuleLoadRequest.cpp
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/loader/ModuleLoadRequest.cpp')
-rw-r--r--js/loader/ModuleLoadRequest.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/js/loader/ModuleLoadRequest.cpp b/js/loader/ModuleLoadRequest.cpp
index 7313563df9..1a02ba6dbb 100644
--- a/js/loader/ModuleLoadRequest.cpp
+++ b/js/loader/ModuleLoadRequest.cpp
@@ -108,8 +108,6 @@ void ModuleLoadRequest::SetReady() {
// dependencies have had their source loaded, parsed as a module and the
// modules instantiated.
- AssertAllImportsFinished();
-
ScriptLoadRequest::SetReady();
if (mWaitingParentRequest) {
@@ -162,7 +160,7 @@ void ModuleLoadRequest::ModuleErrored() {
LOG(("ScriptLoadRequest (%p): Module errored", this));
- if (IsCanceled()) {
+ if (IsCanceled() || IsCancelingImports()) {
return;
}
@@ -195,6 +193,7 @@ void ModuleLoadRequest::DependenciesLoaded() {
MOZ_ASSERT(!IsErrored());
CheckModuleDependenciesLoaded();
+ AssertAllImportsFinished();
SetReady();
LoadFinished();
}
@@ -223,9 +222,22 @@ void ModuleLoadRequest::CheckModuleDependenciesLoaded() {
}
void ModuleLoadRequest::CancelImports() {
+ State origState = mState;
+
+ // To prevent reentering ModuleErrored() for this request via mImports[i]'s
+ // ChildLoadComplete().
+ mState = State::CancelingImports;
+
for (size_t i = 0; i < mImports.Length(); i++) {
+ if (mLoader->IsFetchingAndHasWaitingRequest(mImports[i])) {
+ LOG(("CancelImports import %p is fetching and has waiting\n",
+ mImports[i].get()));
+ continue;
+ }
mImports[i]->Cancel();
}
+
+ mState = origState;
}
void ModuleLoadRequest::LoadFinished() {