From f0b7ba1e2b49858ce2755c61beebe3694cae882f Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 07:23:48 -0400 Subject: Bug 1419799 - Fix nsContentUtils::IsInSameAnonymousTree in Shadow DOM Tag #1375 --- dom/base/crashtests/1419799.html | 17 +++++++++++++++++ dom/base/crashtests/crashtests.list | 1 + dom/base/nsContentUtils.cpp | 12 +----------- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 dom/base/crashtests/1419799.html (limited to 'dom') diff --git a/dom/base/crashtests/1419799.html b/dom/base/crashtests/1419799.html new file mode 100644 index 0000000000..b6d34a1a97 --- /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 index d8b5e9625a..8b115fd4de 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -210,3 +210,4 @@ load 1251361.html load 1304437.html pref(clipboard.autocopy,true) load 1385272-1.html pref(dom.webcomponents.customelements.enabled,true) load 1341693.html +pref(dom.webcomponents.enabled,true) load 1419799.html diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 62be71b4ab..502c409778 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -4955,17 +4955,7 @@ nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode, 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(); } class AnonymousContentDestroyer : public Runnable { -- cgit v1.2.3