summaryrefslogtreecommitdiffstats
path: root/js/loader/ModuleLoadRequest.cpp
diff options
context:
space:
mode:
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() {