Assert that entry exists before removing it. Bug 876155, r=ehsan, a=akeybl
authorSimon Montagu <smontagu@smontagu.org>
Wed, 29 May 2013 10:36:59 +0300
changeset 142838 43aa57061359aa56c773651dd7fe99af345c3a75
parent 142837 e3ec3f1deecdb16760ab67368708e686b311628b
child 142839 ceb056aa850049007d8acdedc504afa32e79f56a
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, akeybl
bugs876155
milestone23.0a2
Assert that entry exists before removing it. Bug 876155, r=ehsan, a=akeybl
content/base/src/DirectionalityUtils.cpp
--- a/content/base/src/DirectionalityUtils.cpp
+++ b/content/base/src/DirectionalityUtils.cpp
@@ -455,22 +455,22 @@ public:
       mElements.Put(aElement);
       aElement->SetProperty(nsGkAtoms::dirAutoSetBy, aTextNode);
       aElement->SetHasDirAutoSet();
     }
   }
 
   void RemoveEntry(nsINode* aTextNode, Element* aElement)
   {
-    if (mElements.Contains(aElement)) {
-      mElements.Remove(aElement);
+    NS_ASSERTION(mElements.Contains(aElement),
+                 "element already removed from map");
 
-      aElement->ClearHasDirAutoSet();
-      aElement->UnsetProperty(nsGkAtoms::dirAutoSetBy);
-    }
+    mElements.Remove(aElement);
+    aElement->ClearHasDirAutoSet();
+    aElement->UnsetProperty(nsGkAtoms::dirAutoSetBy);
   }
 
 private:
   nsCheapSet<nsPtrHashKey<Element> > mElements;
 
   static nsTextNodeDirectionalityMap* GetDirectionalityMap(nsINode* aTextNode)
   {
     MOZ_ASSERT(aTextNode->NodeType() == nsIDOMNode::TEXT_NODE,