Bug 1581958 - Add sub-menu to watchpoints context menu r=jlast
☠☠ backed out by 0b29aabf3ae7 ☠ ☠
authorMiriam <bmiriam1230@gmail.com>
Thu, 19 Sep 2019 16:31:12 +0000
changeset 494071 4827f64f1e1826b0579e196453409e5dc5b755d7
parent 494070 4a539bd0f9bae85c47ad1786817f738c97c1885f
child 494072 39774e958953ae74da02ca946886b4726b3ca342
push id36595
push usermalexandru@mozilla.com
push dateFri, 20 Sep 2019 03:57:39 +0000
treeherdermozilla-central@c77eb3f5ee05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1581958
milestone71.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 1581958 - Add sub-menu to watchpoints context menu r=jlast Differential Revision: https://phabricator.services.mozilla.com/D46333
devtools/client/debugger/src/components/SecondaryPanes/Scopes.js
devtools/client/debugger/test/mochitest/browser_dbg-watchpoints.js
devtools/client/debugger/test/mochitest/helpers.js
devtools/client/locales/en-US/debugger.properties
--- a/devtools/client/debugger/src/components/SecondaryPanes/Scopes.js
+++ b/devtools/client/debugger/src/components/SecondaryPanes/Scopes.js
@@ -123,49 +123,56 @@ class Scopes extends PureComponent<Props
       !item.parent ||
       !item.parent.contents ||
       !item.contents.configurable
     ) {
       return;
     }
 
     if (!item.contents || item.contents.watchpoint) {
+      const removeWatchpointLabel = L10N.getStr("watchpoints.removeWatchpoint");
+
       const removeWatchpointItem = {
         id: "node-menu-remove-watchpoint",
-        // NOTE: we're going to update the UI to add a "break on..."
-        // sub menu. At that point we'll translate the strings. bug 1580591
-        label: "Remove watchpoint",
+        label: removeWatchpointLabel,
         disabled: false,
         click: () => removeWatchpoint(item),
       };
 
       const menuItems = [removeWatchpointItem];
       return showMenu(event, menuItems);
     }
 
-    // NOTE: we're going to update the UI to add a "break on..."
-    // sub menu. At that point we'll translate the strings. bug 1580591
-    const addSetWatchpointLabel = "Pause on set";
-    const addGetWatchpointLabel = "Pause on get";
+    const addSetWatchpointLabel = L10N.getStr("watchpoints.setWatchpoint");
+    const addGetWatchpointLabel = L10N.getStr("watchpoints.getWatchpoint");
+    const watchpointsSubmenuLabel = L10N.getStr("watchpoints.submenu");
 
-    const addSetWatchpoint = {
+    const addSetWatchpointItem = {
       id: "node-menu-add-set-watchpoint",
       label: addSetWatchpointLabel,
       disabled: false,
       click: () => addWatchpoint(item, "set"),
     };
 
-    const addGetWatchpoint = {
+    const addGetWatchpointItem = {
       id: "node-menu-add-get-watchpoint",
       label: addGetWatchpointLabel,
       disabled: false,
       click: () => addWatchpoint(item, "get"),
     };
 
-    const menuItems = [addGetWatchpoint, addSetWatchpoint];
+    const watchpointsSubmenuItem = {
+      id: "node-menu-watchpoints",
+      label: watchpointsSubmenuLabel,
+      disabled: false,
+      click: () => addWatchpoint(item, "set"),
+      submenu: [addSetWatchpointItem, addGetWatchpointItem],
+    };
+
+    const menuItems = [watchpointsSubmenuItem];
     showMenu(event, menuItems);
   };
 
   renderScopesList() {
     const {
       cx,
       isLoading,
       openLink,
--- a/devtools/client/debugger/test/mochitest/browser_dbg-watchpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-watchpoints.js
@@ -11,17 +11,18 @@ add_task(async function() {
   await navigate(dbg, "doc-watchpoints.html", "doc-watchpoints.html");
   await selectSource(dbg, "doc-watchpoints.html");
   await waitForPaused(dbg);
 
   info(`Add a get watchpoint at b`);
   await toggleScopeNode(dbg, 3);
   const addedWatchpoint = waitForDispatch(dbg, "SET_WATCHPOINT");
   await rightClickScopeNode(dbg, 5);
-  selectContextMenuItem(dbg, selectors.addGetWatchpoint);
+  selectContextMenuItem(dbg, selectors.watchpointsSubmenu);
+  document.querySelector(selectors.addGetWatchpoint).click();
   await addedWatchpoint;
 
   info(`Resume and wait to pause at the access to b on line 12`);
   resume(dbg);
   await waitForPaused(dbg);
   await waitForState(dbg, () => dbg.selectors.getSelectedInlinePreviews());
   assertPausedAtSourceAndLine(
     dbg,
--- a/devtools/client/debugger/test/mochitest/helpers.js
+++ b/devtools/client/debugger/test/mochitest/helpers.js
@@ -1297,16 +1297,17 @@ const selectors = {
   projectSerchExpandedResults: ".project-text-search .result",
   threadsPaneItems: ".threads-pane .thread",
   threadsPaneItem: i => `.threads-pane .thread:nth-child(${i})`,
   threadsPaneItemPause: i => `${selectors.threadsPaneItem(i)} .pause-badge`,
   CodeMirrorLines: ".CodeMirror-lines",
   inlinePreviewLables: ".CodeMirror-linewidget .inline-preview-label",
   inlinePreviewValues: ".CodeMirror-linewidget .inline-preview-value",
   inlinePreviewOpenInspector: ".inline-preview-value button.open-inspector",
+  watchpointsSubmenu: "#node-menu-watchpoints",
   addGetWatchpoint: "#node-menu-add-get-watchpoint",
   addSetWatchpoint: "#node-menu-add-set-watchpoint",
   removeWatchpoint: "#node-menu-remove-watchpoint",
   logEventsCheckbox: ".events-header input",
 };
 
 function getSelector(elementName, ...args) {
   let selector = selectors[elementName];
--- a/devtools/client/locales/en-US/debugger.properties
+++ b/devtools/client/locales/en-US/debugger.properties
@@ -486,16 +486,27 @@ xhrBreakpoints.label=Add XHR breakpoint
 
 # LOCALIZATION NOTE (xhrBreakpoints.item.label): message displayed when reaching a breakpoint for XHR requests. %S is replaced by the path provided as condition for the breakpoint.
 xhrBreakpoints.item.label=URL contains ā€œ%Sā€
 
 # LOCALIZATION NOTE (pauseOnAnyXHR): The pause on any XHR checkbox description
 # when the debugger will pause on any XHR requests.
 pauseOnAnyXHR=Pause on any URL
 
+# LOCALIZATION NOTE (watchpoints.submenu): This is the text for the watchpoints sub-menu.
+watchpoints.submenu=Break on...
+
+# LOCALIZATION NOTE (watchpoints.getWatchpoint): This is the text that appears in the
+# watchpoints sub-menu to add a "get" watchpoint on an object property.
+watchpoints.getWatchpoint=Property get
+
+# LOCALIZATION NOTE (watchpoints.setWatchpoint): This is the text that appears in the
+# watchpoints submenu to add a "set" watchpoint on an object property.
+watchpoints.setWatchpoint=Property set
+
 # LOCALIZATION NOTE (watchpoints.removeWatchpoint): This is the text that appears in the
 # context menu to delete a watchpoint on an object property.
 watchpoints.removeWatchpoint=Remove watchpoint
 
 # LOCALIZATION NOTE (sourceTabs.closeTab): Editor source tab context menu item
 # for closing the selected tab below the mouse.
 sourceTabs.closeTab=Close tab
 sourceTabs.closeTab.accesskey=c
@@ -785,17 +796,17 @@ whyPaused.xhr=Paused on XMLHttpRequest
 # LOCALIZATION NOTE (whyPaused.promiseRejection): The text that is displayed
 # in a info block explaining how the debugger is currently paused on a
 # promise rejection
 whyPaused.promiseRejection=Paused on promise rejection
 
 # LOCALIZATION NOTE (whyPaused.getWatchpoint): The text that is displayed
 # in a info block explaining how the debugger is currently paused at a
 # watchpoint on an object property
-whyPaused.getWatchpoint=Paused on property access
+whyPaused.getWatchpoint=Paused on property get
 
 # LOCALIZATION NOTE (whyPaused.setWatchpoint): The text that is displayed
 # in an info block explaining how the debugger is currently paused at a
 # watchpoint on an object property
 whyPaused.setWatchpoint=Paused on property set
 
 # LOCALIZATION NOTE (whyPaused.assert): The text that is displayed
 # in a info block explaining how the debugger is currently paused on an