Bug 1596451 - Remove GetBindingParent() usage in IDTracker. r=bzbarsky
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 14 Nov 2019 23:07:34 +0000
changeset 502147 dde69745453204c798161277bf2c905183b1b545
parent 502146 76ad398222a6809bef3116d77b580ef3e9339cce
child 502148 9cfd6d345f8d512d19c0ab89f80f110c5f6548e0
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)
reviewersbzbarsky
bugs1596451
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 1596451 - Remove GetBindingParent() usage in IDTracker. r=bzbarsky We always fall through if !IsInNativeAnonymousContent(), as GetAnonRootIfInAnonymousContentContainer will return null. Differential Revision: https://phabricator.services.mozilla.com/D53031
dom/base/IDTracker.cpp
--- a/dom/base/IDTracker.cpp
+++ b/dom/base/IDTracker.cpp
@@ -52,24 +52,22 @@ void IDTracker::ResetToURIFragmentID(nsI
   DocumentOrShadowRoot* docOrShadow = DocOrShadowFromContent(*aFromContent);
   auto encoding = doc->GetDocumentCharacterSet();
 
   nsAutoString ref;
   nsresult rv = encoding->DecodeWithoutBOMHandling(refPart, ref);
   if (NS_FAILED(rv) || ref.IsEmpty()) {
     return;
   }
-  rv = NS_OK;
 
-  nsIContent* bindingParent = aFromContent->GetBindingParent();
-  if (bindingParent && !aFromContent->IsInShadowTree()) {
+  if (aFromContent->IsInNativeAnonymousSubtree()) {
     // This happens, for example, if aFromContent is part of the content
     // inserted by a call to Document::InsertAnonymousContent, which we
-    // also want to handle.  (It also happens for <use>'s anonymous
-    // content etc.)
+    // also want to handle.  (It also happens for other native anonymous content
+    // etc.)
     Element* anonRoot =
         doc->GetAnonRootIfInAnonymousContentContainer(aFromContent);
     if (anonRoot) {
       mElement = nsContentUtils::MatchElementId(anonRoot, ref);
       // We don't have watching working yet for anonymous content, so bail out
       // here.
       return;
     }