tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit fea6941decfbf06b7c94f566cfce03d7384bdbb0
parent d4d6e5b33259819ce7c2af916249a5e74778b00d
Author: Olli Pettay <Olli.Pettay@helsinki.fi>
Date:   Mon, 10 Nov 2025 13:12:51 +0000

Bug 1944819, no need to check if parent is a descendant of a new child, if new child doesn't have possible containers as its children, r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D271900

Diffstat:
Mdom/base/nsINode.cpp | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp @@ -2553,12 +2553,13 @@ static void EnsureAllowedAsChild(nsINode* aNewChild, nsINode* aParent, "can't be parents!"); // Step 2. - // A common case is that aNewChild has no kids, in which case + // A common case is that aNewChild has no element kids, in which case // aParent can't be a descendant of aNewChild unless they're // actually equal to each other. Fast-path that case, since aParent // could be pretty deep in the DOM tree. if (aNewChild == aParent || - ((aNewChild->GetFirstChild() || + (((aNewChild->HasFlag(NODE_MAY_HAVE_ELEMENT_CHILDREN) && + aNewChild->GetFirstChild()) || // HTML template elements and ShadowRoot hosts need // to be checked to ensure that they are not inserted into // the hosted content.