Bug 881370 - Remove entry from Debugger HashMap before instead of after mutating the HashMap. r=jimb
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 12 Jun 2013 20:00:07 +0200
changeset 135184 7c1cf26d1bccf2c2dae78cd3651c6f96de890494
parent 135183 702e35c02b970dbb9bac23f93b684f4155e7cff7
child 135185 473252f1819d0fcf0ce8a8ad09c2f19459af05c6
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjimb
bugs881370
milestone24.0a1
Bug 881370 - Remove entry from Debugger HashMap before instead of after mutating the HashMap. r=jimb
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -3392,24 +3392,24 @@ Debugger::handleBaselineOsr(JSContext *c
 
         // Update frame object's ScriptFrameIter::data pointer.
         DebuggerFrame_freeScriptFrameIterData(cx->runtime()->defaultFreeOp(), frameobj);
         ScriptFrameIter::Data *data = iter.copyData();
         if (!data)
             return false;
         frameobj->setPrivate(data);
 
+        // Remove the old entry before mutating the HashMap.
+        r.removeFrontFrame();
+
         // Add the frame object with |to| as key.
         if (!dbg->frames.putNew(to, frameobj)) {
             js_ReportOutOfMemory(cx);
             return false;
         }
-
-        // Remove the old entry.
-        r.removeFrontFrame();
     }
 
     return true;
 }
 
 static JSBool
 DebuggerScript_setBreakpoint(JSContext *cx, unsigned argc, Value *vp)
 {