Bug 1911009 - Ensure nsRange::mCrossShadowBoundaryRange can only be created when both nodes are in the document r=jjaschke,dom-core

Differential Revision: https://phabricator.services.mozilla.com/D218352
This commit is contained in:
Sean Feng 2024-08-02 13:46:18 +00:00
parent 63d5d93f51
commit 027dd359b1

View File

@ -3512,6 +3512,12 @@ void nsRange::CreateOrUpdateCrossShadowBoundaryRangeIfNeeded(
return;
}
// Nodes at least needs to be in the same document.
if (startNode && endNode &&
startNode->GetComposedDoc() != endNode->GetComposedDoc()) {
return;
}
auto CanBecomeCrossShadowBoundaryPoint = [](nsINode* aContainer) -> bool {
if (!aContainer) {
return true;