diff options
author | Moonchild <moonchild@palemoon.org> | 2021-08-12 00:27:34 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-08-12 00:27:34 +0000 |
commit | 78992fe27e0f1a7a0a2c34037ddd4a195deeddb4 (patch) | |
tree | 9a92fe057dd03677f7adee47497b359484511ac1 | |
parent | 8d705611b1221871c6591c7500cfc65f3522c22a (diff) | |
download | uxp-78992fe27e0f1a7a0a2c34037ddd4a195deeddb4.tar.gz |
[DOM/NPAPI] Defer loading object when setting attribute.
-rw-r--r-- | dom/html/HTMLObjectElement.cpp | 8 | ||||
-rw-r--r-- | dom/html/HTMLSharedObjectElement.cpp | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/dom/html/HTMLObjectElement.cpp b/dom/html/HTMLObjectElement.cpp index e0e79b69af..a0d06a8c65 100644 --- a/dom/html/HTMLObjectElement.cpp +++ b/dom/html/HTMLObjectElement.cpp @@ -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; } } diff --git a/dom/html/HTMLSharedObjectElement.cpp b/dom/html/HTMLSharedObjectElement.cpp index f0cf4c188c..d7eec215a0 100644 --- a/dom/html/HTMLSharedObjectElement.cpp +++ b/dom/html/HTMLSharedObjectElement.cpp @@ -177,8 +177,13 @@ HTMLSharedObjectElement::AfterMaybeChangeAttr(int32_t aNamespaceID, // a document, just in case that the caller wants to set additional // attributes before inserting the node into the document. if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren) { - nsresult rv = LoadObject(aNotify, true); - NS_ENSURE_SUCCESS(rv, rv); + nsContentUtils::AddScriptRunner(NS_NewRunnableFunction( + [self = RefPtr<HTMLSharedObjectElement>(this), aNotify]() { + if (self->IsInComposedDoc()) { + self->LoadObject(aNotify, true); + } + })); + return NS_OK; } } } |