Bug 1251965 - fix "remove other breakpoints" command in debugger r=me
authorJames Long <longster@gmail.com>
Tue, 01 Mar 2016 11:43:08 -0500
changeset 322640 39c23264761c7a9828597e2ccabbc1ae3cac1f0b
parent 322639 f3c825e2db438ae6be21e157f86f88ed18f62b0d
child 322641 47eb779302fa63ada9a1f7e10c0107ea0b08a9bd
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1251965
milestone47.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 1251965 - fix "remove other breakpoints" command in debugger r=me
devtools/client/debugger/content/actions/breakpoints.js
--- a/devtools/client/debugger/content/actions/breakpoints.js
+++ b/devtools/client/debugger/content/actions/breakpoints.js
@@ -95,23 +95,34 @@ function _removeOrDisableBreakpoint(loca
     }
     if (bp.loading) {
       // TODO(jwl): make this wait until the breakpoint is saved if it
       // is still loading
       throw new Error('attempt to remove unsaved breakpoint');
     }
 
     const bpClient = getBreakpointClient(bp.actor);
-
-    return dispatch({
+    const action = {
       type: constants.REMOVE_BREAKPOINT,
       breakpoint: bp,
-      disabled: isDisabled,
-      [PROMISE]: bpClient.remove()
-    });
+      disabled: isDisabled
+    };
+
+    // If the breakpoint is already disabled, we don't need to remove
+    // it from the server. We just need to dispatch an action
+    // simulating a successful server request to remove it, and it
+    // will be removed completely from the state.
+    if(!bp.disabled) {
+      return dispatch(Object.assign({}, action, {
+        [PROMISE]: bpClient.remove()
+      }));
+    }
+    else {
+      return dispatch(Object.assign({}, action, { status: "done" }));
+    }
   }
 }
 
 function removeAllBreakpoints() {
   return (dispatch, getState) => {
     const breakpoints = getBreakpoints(getState());
     const activeBreakpoints = breakpoints.filter(bp => !bp.disabled);
     activeBreakpoints.forEach(bp => removeBreakpoint(bp.location));