Bug 1555216 - Cache owner doc in the BindContext. r=bzbarsky

And use it to avoid some pointer chases per the review comments of D32949.

Differential Revision: https://phabricator.services.mozilla.com/D33288
This commit is contained in:
Emilio Cobos Álvarez
2019-05-31 16:33:33 +02:00
parent 1534328f98
commit ec4b914a30
22 changed files with 115 additions and 90 deletions

View File

@@ -208,15 +208,15 @@ nsresult HTMLObjectElement::BindToTree(BindContext& aContext,
// Don't kick off load from being bound to a plugin document - the plugin
// document will call nsObjectLoadingContent::InitializeFromChannel() for the
// initial load.
//
// FIXME(emilio): Seems wasteful to queue the runnable unconditionally
// otherwise.
nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(GetUncomposedDoc());
// If we already have all the children, start the load.
if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad;
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLObjectElement::BindToTree", this, start));
if (IsInComposedDoc()) {
nsCOMPtr<nsIPluginDocument> pluginDoc =
do_QueryInterface(&aContext.OwnerDoc());
// If we already have all the children, start the load.
if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad;
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLObjectElement::BindToTree", this, start));
}
}
return NS_OK;