Bug 1596506 - Remove GetBindingParent usage from nsXULElement::BindToTree. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 14 Nov 2019 20:55:01 +0000
changeset 502133 c7c61985bf36098a2ef0d038a7fdc94e1b2624c1
parent 502132 94cd78feaa1f293c4cf8e34d70c5ee9f02e1561f
child 502134 45374ab225daf31a9dc7f765e4587dd1cd7be7d9
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1596506
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596506 - Remove GetBindingParent usage from nsXULElement::BindToTree. r=smaug This is technically a behavior change, but the current thing is more correct anyways, IMO, and it's only a warning in any case. Differential Revision: https://phabricator.services.mozilla.com/D53058
dom/xul/nsXULElement.cpp
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -578,29 +578,27 @@ static bool NeedTooltipSupport(const nsX
   return aXULElement.GetBoolAttr(nsGkAtoms::tooltip) ||
          aXULElement.GetBoolAttr(nsGkAtoms::tooltiptext);
 }
 
 nsresult nsXULElement::BindToTree(BindContext& aContext, nsINode& aParent) {
   nsresult rv = nsStyledElement::BindToTree(aContext, aParent);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  Document& doc = aContext.OwnerDoc();
+  if (!IsInComposedDoc()) {
+    return rv;
+  }
 
-  // FIXME(emilio): Could use IsInComposedDoc().
-  if (!aContext.GetBindingParent() && IsInUncomposedDoc() &&
-      !doc.IsLoadedAsInteractiveData() && !doc.AllowXULXBL() &&
+  Document& doc = aContext.OwnerDoc();
+  if (!IsInNativeAnonymousSubtree() && !doc.IsLoadedAsInteractiveData() &&
+      !doc.AllowXULXBL() &&
       !doc.HasWarnedAbout(Document::eImportXULIntoContent)) {
     nsContentUtils::AddScriptRunner(new XULInContentErrorReporter(doc));
   }
 
-  if (!IsInComposedDoc()) {
-    return rv;
-  }
-
 #ifdef DEBUG
   if (!doc.AllowXULXBL() && !doc.IsUnstyledDocument()) {
     // To save CPU cycles and memory, non-XUL documents only load the user
     // agent style sheet rules for a minimal set of XUL elements such as
     // 'scrollbar' that may be created implicitly for their content (those
     // rules being in minimal-xul.css).
     //
     // This assertion makes sure no other XUL element is used in a non-XUL