summaryrefslogtreecommitdiffstats
path: root/js/loader/ModuleLoadRequest.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /js/loader/ModuleLoadRequest.cpp
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/loader/ModuleLoadRequest.cpp')
-rw-r--r--js/loader/ModuleLoadRequest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/loader/ModuleLoadRequest.cpp b/js/loader/ModuleLoadRequest.cpp
index d90d41da58..7e188160fc 100644
--- a/js/loader/ModuleLoadRequest.cpp
+++ b/js/loader/ModuleLoadRequest.cpp
@@ -27,6 +27,9 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(ModuleLoadRequest)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ModuleLoadRequest,
ScriptLoadRequest)
+ if (tmp->mWaitingParentRequest) {
+ tmp->mWaitingParentRequest->ChildModuleUnlinked();
+ }
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoader, mRootModule, mModuleScript, mImports,
mWaitingParentRequest,
mDynamicReferencingScript)
@@ -230,6 +233,18 @@ void ModuleLoadRequest::LoadFinished() {
mLoader->OnModuleLoadComplete(request);
}
+void ModuleLoadRequest::ChildModuleUnlinked() {
+ // This module was waiting for a child request, but the child reqeust
+ // got unlinked by CC and will never complete.
+ // It also means this module itself is also in the cycle, and will be
+ // unlinked or has already been unlinked, and will be collected.
+ // There's no need to normally finish the module request.
+ // Just reflect the awaiting imports count, so that the assertion in the
+ // destructor passes.
+ MOZ_ASSERT(mAwaitingImports > 0);
+ mAwaitingImports--;
+}
+
void ModuleLoadRequest::SetDynamicImport(LoadedScript* aReferencingScript,
JS::Handle<JSString*> aSpecifier,
JS::Handle<JSObject*> aPromise) {