# HG changeset patch # User Jessica Jong # Parent 4b94da21a9e6171f9911ffad171af23c26e6227b Bug 1419799 - No need to consider multiple shadow roots in nsContentUtils::IsInSameAnonymousTree. r=smaug Multiple shadow roots is only supported in Shadow DOM v0, which is deprecated now. MozReview-Commit-ID: BKemIBiMx1Q diff --git a/dom/base/crashtests/1419799.html b/dom/base/crashtests/1419799.html new file mode 100644 --- /dev/null +++ b/dom/base/crashtests/1419799.html @@ -0,0 +1,17 @@ + + + + + diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -231,8 +231,9 @@ load 1393806.html load 1396466.html load 1400701.html load 1403377.html load 1405771.html load 1406109-1.html pref(dom.webcomponents.enabled,true) load 1324463.html pref(dom.webcomponents.customelements.enabled,true) load 1413815.html load 1411473.html +pref(dom.webcomponents.enabled,true) load 1419799.html diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5445,27 +5445,17 @@ nsContentUtils::IsInSameAnonymousTree(co * nodes in the same anonymous subtree as it will have a null * bindingParent. * * XXXbz strictly speaking, that's not true for attribute nodes. */ return aContent->GetBindingParent() == nullptr; } - const nsIContent* nodeAsContent = static_cast(aNode); - - // For nodes in a shadow tree, it is insufficient to simply compare - // the binding parent because a node may host multiple ShadowRoots, - // thus nodes in different shadow tree may have the same binding parent. - if (aNode->IsInShadowTree()) { - return nodeAsContent->GetContainingShadow() == - aContent->GetContainingShadow(); - } - - return nodeAsContent->GetBindingParent() == aContent->GetBindingParent(); + return aNode->AsContent()->GetBindingParent() == aContent->GetBindingParent(); } /* static */ void nsContentUtils::NotifyInstalledMenuKeyboardListener(bool aInstalling) { IMEStateManager::OnInstalledMenuKeyboardListener(aInstalling); }