Closed
Bug 1880708
Opened 2 years ago
Closed 2 years ago
ModuleLoaderBase's cleanup methods should expect CC unlinks pointers before calling them
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
125 Branch
| Tracking | Status | |
|---|---|---|
| firefox125 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
bug 1874686 discovers that JS::loader::ModuleLoaderBase::CancelDynamicImport can be called on a ModuleLoadRequest which is already unlinked by CC,
that results in failing the following assertion, because mLoader is set to null by unlink:
void ModuleLoaderBase::CancelDynamicImport(ModuleLoadRequest* aRequest,
nsresult aResult) {
MOZ_ASSERT(aRequest->mLoader == this);
that happens in the following route:
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Document)
...
tmp->SetScriptGlobalObject(nullptr);
void Document::SetScriptGlobalObject(
...
if (mScriptLoader && !IsTemplateContentsOwner()) {
mScriptLoader->SetGlobalObject(mScriptGlobalObject);
void ScriptLoader::SetGlobalObject(nsIGlobalObject* aGlobalObject) {
if (!aGlobalObject) {
// The document is being detached.
CancelAndClearScriptLoadRequests();
void ScriptLoader::CancelAndClearScriptLoadRequests() {
...
if (mModuleLoader) {
mModuleLoader->CancelAndClearDynamicImports();
void ModuleLoaderBase::CancelAndClearDynamicImports() {
while (ScriptLoadRequest* req = mDynamicImportRequests.getFirst()) {
// This also removes the request from the list.
CancelDynamicImport(req->AsModuleRequest(), NS_ERROR_ABORT);
void ModuleLoaderBase::CancelDynamicImport(ModuleLoadRequest* aRequest,
nsresult aResult) {
MOZ_ASSERT(aRequest->mLoader == this);
So, methods which can be called while CC unlink should expect that the unlink already happened for the related objects.
| Assignee | ||
Comment 1•2 years ago
|
||
setting to S4 given this is debug-only assertion failure.
Severity: -- → S4
Type: task → defect
Priority: -- → P3
| Assignee | ||
Updated•2 years ago
|
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•2 years ago
|
||
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/e30a2fca300e
Handle CC unlink when destroying ScriptLoader/ModuleLoader. r=jonco
Comment 4•2 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
status-firefox125:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•