Bug 1574053 - allow shift-click to disable column breakpoints.
authorAlex Rosenfeld <arosenfeld2003@mac.com>
Tue, 27 Aug 2019 16:29:19 +0000
changeset 490251 b7d1b3ab0fb53cfed87544b46538241dae4eb181
parent 490250 9be49e3e9e296114be312d811d4f487951f81e0b
child 490252 e30c654504e60a2224b1cf7efb31c0902ed459e1
push id36498
push usershindli@mozilla.com
push dateWed, 28 Aug 2019 00:52:57 +0000
treeherdermozilla-central@0e52e746c47a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1574053
milestone70.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 1574053 - allow shift-click to disable column breakpoints. Allow user to disable column breakpoints with shift-click. Added mochitests to reinforce. r=jlast. Differential Revision: https://phabricator.services.mozilla.com/D43326
devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
--- a/devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js
+++ b/devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js
@@ -84,16 +84,23 @@ export default class ColumnBreakpoint ex
       this.bookmark = null;
     }
   };
 
   onClick = (event: MouseEvent) => {
     event.stopPropagation();
     event.preventDefault();
     const { cx, columnBreakpoint, breakpointActions } = this.props;
+
+    // disable column breakpoint on shift-click.
+    if (event.shiftKey) {
+      const breakpoint: breakpoint = columnBreakpoint.breakpoint;
+      return breakpointActions.toggleDisabledBreakpoint(cx, breakpoint);
+    }
+
     if (columnBreakpoint.breakpoint) {
       breakpointActions.removeBreakpoint(cx, columnBreakpoint.breakpoint);
     } else {
       breakpointActions.addBreakpoint(cx, columnBreakpoint.location);
     }
   };
 
   onContextMenu = (event: MouseEvent) => {
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
@@ -18,16 +18,34 @@ async function enableSecondBreakpoint(db
   bpMarkers[1].click();
   await waitForBreakpointCount(dbg, 2);
 
   bpMarkers = findAllElements(dbg, "columnBreakpoints");
   assertClass(bpMarkers[1], "active");
   await waitForAllElements(dbg, "breakpointItems", 2);
 }
 
+// disable active column bp with shift-click.
+async function shiftClickDisable(dbg) {
+  let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
+  debugger;
+  shiftClickElement(dbg, "columnBreakpoints");
+  bpMarkers = findAllElements(dbg, "columnBreakpoints");
+  debugger;
+  assertClass(bpMarkers[0], "disabled");
+}
+
+// re-enable disabled column bp with shift-click.
+async function shiftClickEnable(dbg) {
+  let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
+  shiftClickElement(dbg, "columnBreakpoints");
+  bpMarkers = findAllElements(dbg, "columnBreakpoints");
+  assertClass(bpMarkers[0], "active");
+}
+
 async function setConditionalBreakpoint(dbg, index, condition) {
   let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
   rightClickEl(dbg, bpMarkers[index]);
   selectContextMenuItem(dbg, selectors.addConditionItem);
   await typeInPanel(dbg, condition);
   await waitForCondition(dbg, condition);
 
   bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
@@ -79,26 +97,32 @@ add_task(async function() {
   await selectSource(dbg, "long");
 
   info("1. Add a column breakpoint on line 32");
   await enableFirstBreakpoint(dbg);
 
   info("2. Click on the second breakpoint on line 32");
   await enableSecondBreakpoint(dbg);
 
-  info("3. Add a condition to the first breakpoint");
+  info("3. Disable second breakpoint using shift-click");
+  await shiftClickDisable(dbg);
+
+  info("4. Re-enable second breakpoint using shift-click");
+  await shiftClickEnable(dbg);
+
+  info("5. Add a condition to the first breakpoint");
   await setConditionalBreakpoint(dbg, 0, "foo");
 
-  info("4. Add a log to the first breakpoint");
+  info("6. Add a log to the first breakpoint");
   await setLogPoint(dbg, 0, "bar");
 
-  info("5. Disable the first breakpoint");
+  info("7. Disable the first breakpoint");
   await disableBreakpoint(dbg, 0);
 
-  info("6. Remove the first breakpoint");
+  info("8. Remove the first breakpoint");
   await removeFirstBreakpoint(dbg);
 
-  info("7. Add a condition to the second breakpoint");
+  info("9. Add a condition to the second breakpoint");
   await setConditionalBreakpoint(dbg, 1, "foo2");
 
-  info("8. test removing the breakpoints by clicking in the gutter");
+  info("10. Test removing the breakpoints by clicking in the gutter");
   await removeAllBreakpoints(dbg, 32, 0);
 });