Bug 1517334 - [release 114] [breakpoints] Gutter menu fix for column breakpoints (#7593). r=dwalsh
authorJason Laster <jlaster@mozilla.com>
Wed, 02 Jan 2019 16:00:21 -0500
changeset 509426 0c91bc0bcba36bf275f3377ddaa7dd28a9d8a263
parent 509425 83f92b601b0e1b2a53d341aad6a6c29945529170
child 509427 a5c776c629f449dade37cb6711d7516dc1141120
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwalsh
bugs1517334
milestone66.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 1517334 - [release 114] [breakpoints] Gutter menu fix for column breakpoints (#7593). r=dwalsh
devtools/client/debugger/new/src/components/Editor/GutterMenu.js
devtools/client/debugger/new/test/mochitest/browser_dbg-breakpoints-cond.js
--- a/devtools/client/debugger/new/src/components/Editor/GutterMenu.js
+++ b/devtools/client/debugger/new/src/components/Editor/GutterMenu.js
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 import { Component } from "react";
 import { showMenu } from "devtools-contextmenu";
 import { connect } from "../../utils/connect";
 import { lineAtHeight } from "../../utils/editor";
+import { features } from "../../utils/prefs";
 import {
   getContextMenu,
   getEmptyLines,
   getSelectedLocation,
   getSelectedSource,
   getVisibleBreakpoints,
   isPaused as getIsPaused
 } from "../../selectors";
@@ -146,18 +147,20 @@ class GutterContextMenuComponent extends
     const column = props.editor.codeMirror.coordsChar({
       left: event.x,
       top: event.y
     }).ch;
     const breakpoint = nextProps.breakpoints.find(
       bp => bp.location.line === line && bp.location.column === column
     );
 
-    if (props.emptyLines && props.emptyLines.includes(line)) {
-      return;
+    // Allow getFirstVisiblePausePoint to find the best first breakpoint
+    // position by not providing an explicit column number
+    if (features.columnBreakpoints && !breakpoint && column === 0) {
+      column = undefined;
     }
 
     gutterMenu({ event, sourceId, line, column, breakpoint, ...props });
   }
 
   render() {
     return null;
   }
--- a/devtools/client/debugger/new/test/mochitest/browser_dbg-breakpoints-cond.js
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-breakpoints-cond.js
@@ -61,25 +61,26 @@ add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple2");
   await pushPref("devtools.debugger.features.column-breakpoints", false);
 
   await selectSource(dbg, "simple2");
   await waitForSelectedSource(dbg, "simple2");
 
   await setConditionalBreakpoint(dbg, 5, "1");
   await waitForDispatch(dbg, "ADD_BREAKPOINT");
-  
+
   let bp = findBreakpoint(dbg, "simple2", 5);
   is(bp.condition, "1", "breakpoint is created with the condition");
   assertEditorBreakpoint(dbg, 5, true);
 
+  // Edit the conditional breakpoint set above
   await setConditionalBreakpoint(dbg, 5, "2");
   await waitForDispatch(dbg, "SET_BREAKPOINT_CONDITION");
   bp = findBreakpoint(dbg, "simple2", 5);
-  is(bp.condition, "2", "breakpoint is created with the condition");
+  is(bp.condition, "12", "breakpoint is created with the condition");
   assertEditorBreakpoint(dbg, 5, true);
 
   clickElement(dbg, "gutter", 5);
   await waitForDispatch(dbg, "REMOVE_BREAKPOINT");
   bp = findBreakpoint(dbg, "simple2", 5);
   is(bp, null, "breakpoint was removed");
   assertEditorBreakpoint(dbg, 5, false);