[DOM/NPAPI] Defer loading object when setting attribute.

This commit is contained in:
Moonchild
2021-08-12 00:27:34 +00:00
parent 61a3331fe2
commit ca1a84cb93
2 changed files with 14 additions and 3 deletions
+7 -1
View File
@@ -193,7 +193,13 @@ HTMLObjectElement::AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
// attributes before inserting the node into the document.
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
aName == nsGkAtoms::data) {
return LoadObject(aNotify, true);
nsContentUtils::AddScriptRunner(NS_NewRunnableFunction(
[self = RefPtr<HTMLObjectElement>(this), aNotify]() {
if (self->IsInComposedDoc()) {
self->LoadObject(aNotify, true);
}
}));
return NS_OK;
}
}