Bug 1432851 - Remove IsInFeedSubscribeLine assertion when loading xul.css in BindToTree;r=bz draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 24 Jan 2018 09:33:54 -0800
changeset 724217 f16b102fff01a5d61495687773d2c275f5007634
parent 724080 0e62eb7804c00c0996a9bdde5350328a384fb7af
child 747097 2be2cdb1936b0ab3fa0b5b634eb84c2211e04a99
push id96690
push userbgrinstead@mozilla.com
push dateWed, 24 Jan 2018 17:34:20 +0000
reviewersbz
bugs1432851, 1109714
milestone60.0a1
Bug 1432851 - Remove IsInFeedSubscribeLine assertion when loading xul.css in BindToTree;r=bz The feedreaderUI binding was removed in Bug 1109714, so there's no need for this anymore. MozReview-Commit-ID: G38fuS0zqOQ
devtools/server/actors/inspector.js
dom/xul/nsXULElement.cpp
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -3229,23 +3229,21 @@ function standardTreeWalkerFilter(node) 
 
   // Ignore empty whitespace text nodes that do not impact the layout.
   if (isWhitespaceTextNode(node)) {
     return nodeHasSize(node)
            ? nodeFilterConstants.FILTER_ACCEPT
            : nodeFilterConstants.FILTER_SKIP;
   }
 
-  // Ignore all native and XBL anonymous content inside a non-XUL document
+  // Ignore all native and XBL anonymous content inside a non-XUL document.
+  // We need to do this to skip things like form controls, scrollbars,
+  // video controls, etc (see bug 1187482).
   if (!isInXULDocument(node) && (isXBLAnonymous(node) ||
                                   isNativeAnonymous(node))) {
-    // Note: this will skip inspecting the contents of feedSubscribeLine since
-    // that's XUL content injected in an HTML document, but we need to because
-    // this also skips many other elements that need to be skipped - like form
-    // controls, scrollbars, video controls, etc (see bug 1187482).
     return nodeFilterConstants.FILTER_SKIP;
   }
 
   return nodeFilterConstants.FILTER_ACCEPT;
 }
 
 /**
  * This DeepTreeWalker filter is like standardTreeWalkerFilter except that
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -710,39 +710,16 @@ IsInVideoControls(nsXULElement* aElement
   while (ancestor) {
     if (ancestor->NodeInfo()->Equals(nsGkAtoms::videocontrols, kNameSpaceID_XUL)) {
       return true;
     }
     ancestor = ancestor->GetParent();
   }
   return false;
 }
-
-/**
- * Returns true if aElement is an element created by the <binding
- * id="feedreaderUI"> binding or one of the bindings bound to such an element.
- * element in one of the binding for such an element. Only
- * subscribe.xhtml#feedSubscribeLine pulls in the feedreaderUI binding. This
- * binding creates lots of different types of XUL elements.
- */
-bool
-IsInFeedSubscribeLine(nsXULElement* aElement)
-{
-  nsIContent* bindingParent = aElement->GetBindingParent();
-  if (bindingParent) {
-    while (bindingParent->GetBindingParent()) {
-      bindingParent = bindingParent->GetBindingParent();
-    }
-    nsAtom* idAtom = bindingParent->GetID();
-    if (idAtom && idAtom->Equals(NS_LITERAL_STRING("feedSubscribeLine"))) {
-      return true;
-    }
-  }
-  return false;
-}
 #endif
 
 class XULInContentErrorReporter : public Runnable
 {
 public:
   explicit XULInContentErrorReporter(nsIDocument* aDocument)
     : mozilla::Runnable("XULInContentErrorReporter")
     , mDocument(aDocument)
@@ -801,17 +778,17 @@ nsXULElement::BindToTree(nsIDocument* aD
       // for HTML we currently should only pull it in if the document contains
       // an <audio> or <video> element. This assertion is here to make sure
       // that we don't fail to notice if a change to bindings causes us to
       // start pulling in xul.css much more frequently. If this assertion
       // fails then we need to figure out why, and how we can continue to avoid
       // pulling in xul.css.
       // Note that add-ons may introduce bindings that cause this assertion to
       // fire.
-      NS_ASSERTION(IsInVideoControls(this) || IsInFeedSubscribeLine(this),
+      NS_ASSERTION(IsInVideoControls(this),
                    "Unexpected XUL element in non-XUL doc");
     }
   }
 
   if (aDocument) {
       NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
                    "Missing a script blocker!");
       // We're in a document now.  Kick off the frame load.