Bug 1199175 - Fix Debugger::slowPathOnLeaveFrame to remove the frame on OOM too. r=shu
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 19 Sep 2015 20:00:14 +0200
changeset 296026 0ad4ca92e9a909763f054fee3d111f8274d00b61
parent 296025 d29fef133d8a0960a57031f71b299fa58aa4d74d
child 296027 123761e37f2722014766a0c225bd2e15623519f9
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1199175
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1199175 - Fix Debugger::slowPathOnLeaveFrame to remove the frame on OOM too. r=shu
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -596,16 +596,23 @@ Debugger::slowPathOnLeaveFrame(JSContext
 
     // The onPop handler and associated clean up logic should not run multiple
     // times on the same frame. If slowPathOnLeaveFrame has already been
     // called, the frame will not be present in the Debugger frame maps.
     FrameRange frameRange(frame, global);
     if (frameRange.empty())
         return frameOk;
 
+    auto frameMapsGuard = MakeScopeExit([&] {
+        // Clean up all Debugger.Frame instances. This call creates a fresh
+        // FrameRange, as one debugger's onPop handler could have caused another
+        // debugger to create its own Debugger.Frame instance.
+        removeFromFrameMapsAndClearBreakpointsIn(cx, frame);
+    });
+
     /* Save the frame's completion value. */
     JSTrapStatus status;
     RootedValue value(cx);
     Debugger::resultToCompletion(cx, frameOk, frame.returnValue(), &status, &value);
 
     // This path can be hit via unwinding the stack due to over-recursion or
     // OOM. In those cases, don't fire the frames' onPop handlers, because
     // invoking JS will only trigger the same condition. See
@@ -656,23 +663,16 @@ Debugger::slowPathOnLeaveFrame(JSContext
                 if (nextStatus != JSTRAP_CONTINUE) {
                     status = nextStatus;
                     value = nextValue;
                 }
             }
         }
     }
 
-    /*
-     * Clean up all Debugger.Frame instances. This call creates a fresh
-     * FrameRange, as one debugger's onPop handler could have caused another
-     * debugger to create its own Debugger.Frame instance.
-     */
-    removeFromFrameMapsAndClearBreakpointsIn(cx, frame);
-
     /* Establish (status, value) as our resumption value. */
     switch (status) {
       case JSTRAP_RETURN:
         frame.setReturnValue(value);
         return true;
 
       case JSTRAP_THROW:
         cx->setPendingException(value);