Bug 1666184 - Defer loading object when setting attribute; r=nika

Differential Revision: https://phabricator.services.mozilla.com/D116819
This commit is contained in:
Edgar Chen
2021-07-14 14:46:12 +00:00
parent 73b08a6f1e
commit 96ff2df49e
2 changed files with 16 additions and 3 deletions

View File

@@ -145,7 +145,14 @@ nsresult HTMLObjectElement::AfterMaybeChangeAttr(int32_t aNamespaceID,
// attributes before inserting the node into the document.
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
aName == nsGkAtoms::data && !BlockEmbedOrObjectContentLoading()) {
return LoadObject(aNotify, true);
nsContentUtils::AddScriptRunner(NS_NewRunnableFunction(
"HTMLObjectElement::LoadObject",
[self = RefPtr<HTMLObjectElement>(this), aNotify]() {
if (self->IsInComposedDoc()) {
self->LoadObject(aNotify, true);
}
}));
return NS_OK;
}
}