Bug 1402251 - Assert ranges our not added to multiple common ancestor lists. r=smaug
authorCatalin Badea <catalin.badea392@gmail.com>
Mon, 09 Oct 2017 14:13:18 +0100
changeset 427916 82957b8ff351cee2f42e8668b0593ae007594656
parent 427915 e3c821833a142619a13b7ec42250c04d5bf27dbc
child 427917 2a21d7780597b9760df66a084095fbedfc446517
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewerssmaug
bugs1402251
milestone58.0a1
Bug 1402251 - Assert ranges our not added to multiple common ancestor lists. r=smaug
dom/base/nsRange.cpp
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -434,16 +434,18 @@ nsRange::RegisterCommonAncestor(nsINode*
   mRegisteredCommonAncestor = aNode;
 
   MarkDescendants(aNode);
 
   UniquePtr<LinkedList<nsRange>>& ranges = aNode->GetCommonAncestorRangesPtr();
   if (!ranges) {
     ranges = MakeUnique<LinkedList<nsRange>>();
   }
+
+  MOZ_DIAGNOSTIC_ASSERT(!isInList());
   ranges->insertBack(this);
   aNode->SetCommonAncestorForRangeInSelection();
 }
 
 void
 nsRange::UnregisterCommonAncestor(nsINode* aNode, bool aIsUnlinking)
 {
   NS_PRECONDITION(aNode, "bad arg");