Bug 1944506 - Add Remove condition and Remove log items to the debugger gutter breakpoint context menu. r?bomsy
This commit is contained in:
1 parent
400ba3fb5e
commit
628fd9f94d
3 files changed
+80
No files matched your search
@@ -76,7 +76,13 @@ export function showEditorEditBreakpointContextMenu(event, breakpoint) {
|
||||
items.push(
|
||||
conditionalBreakpointItem(breakpoint, selectedLocation, dispatch)
|
||||
);
|
||||
if (breakpoint.options.condition) {
|
||||
items.push(removeConditionItem(breakpoint, selectedLocation, dispatch));
|
||||
}
|
||||
items.push(logPointItem(breakpoint, selectedLocation, dispatch));
|
||||
if (breakpoint.options.logValue) {
|
||||
items.push(removeLogPointItem(breakpoint, selectedLocation, dispatch));
|
||||
}
|
||||
|
||||
showMenu(event, items, { accesskeyConflictsBug: 2073896 });
|
||||
};
|
||||
@@ -159,6 +165,20 @@ const conditionalBreakpointItem = (breakpoint, location, dispatch) => {
|
||||
: addConditionalBreakpointItem(location, dispatch);
|
||||
};
|
||||
|
||||
const removeConditionItem = (breakpoint, location, dispatch) => ({
|
||||
id: "node-menu-remove-condition",
|
||||
label: L10N.getStr("breakpointMenuItem.removeCondition2.label"),
|
||||
accesskey: L10N.getStr("breakpointMenuItem.removeCondition2.accesskey"),
|
||||
disabled: false,
|
||||
click: () =>
|
||||
dispatch(
|
||||
setBreakpointOptions(location, {
|
||||
...breakpoint.options,
|
||||
condition: null,
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
const addLogPointItem = (location, dispatch) => ({
|
||||
id: "node-menu-add-log-point",
|
||||
label: L10N.getStr("editor.addLogPoint"),
|
||||
@@ -190,6 +210,20 @@ const logPointItem = (breakpoint, location, dispatch) => {
|
||||
: addLogPointItem(location, dispatch);
|
||||
};
|
||||
|
||||
const removeLogPointItem = (breakpoint, location, dispatch) => ({
|
||||
id: "node-menu-remove-log",
|
||||
label: L10N.getStr("editor.removeLogPoint.label"),
|
||||
accesskey: L10N.getStr("editor.removeLogPoint.accesskey"),
|
||||
disabled: false,
|
||||
click: () =>
|
||||
dispatch(
|
||||
setBreakpointOptions(location, {
|
||||
...breakpoint.options,
|
||||
logValue: null,
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
const toggleDisabledBreakpointItem = (
|
||||
breakpoint,
|
||||
blackboxedRangesForSelectedSource,
|
||||
|
||||
@@ -129,6 +129,51 @@ add_task(async function () {
|
||||
pressKey(dbg, "Enter");
|
||||
bp = findBreakpoint(dbg, "simple2.js", 5);
|
||||
is(bp.options.logValue, null, "The log value was removed");
|
||||
|
||||
info("The gutter context menu has no remove items for a plain breakpoint");
|
||||
rightClickElement(dbg, "gutterElement", 5);
|
||||
const popup = await waitForContextMenu(dbg);
|
||||
ok(
|
||||
!findContextMenu(dbg, selectors.breakpointContextMenu.removeCondition),
|
||||
"Remove condition is not shown"
|
||||
);
|
||||
ok(!findContextMenu(dbg, selectors.removeLogItem), "Remove log is not shown");
|
||||
await closeContextMenu(dbg, popup);
|
||||
|
||||
info("The condition can be removed using the gutter context menu");
|
||||
await setConditionalBreakpoint(dbg, 5, "1");
|
||||
await waitForCondition(dbg, 1);
|
||||
await assertConditionBreakpoint(dbg, 5);
|
||||
|
||||
rightClickElement(dbg, "gutterElement", 5);
|
||||
await waitForContextMenu(dbg);
|
||||
ok(
|
||||
!findContextMenu(dbg, selectors.removeLogItem),
|
||||
"Remove log is not shown for a conditional breakpoint"
|
||||
);
|
||||
selectContextMenuItem(dbg, selectors.breakpointContextMenu.removeCondition);
|
||||
await waitForBreakpointWithoutCondition(dbg, "simple2.js", 5);
|
||||
bp = findBreakpoint(dbg, "simple2.js", 5);
|
||||
is(bp.options.condition, null, "The condition was removed");
|
||||
|
||||
info("The log value can be removed using the gutter context menu");
|
||||
await setLogPoint(dbg, 5, "44");
|
||||
await waitForLog(dbg, 44);
|
||||
await assertLogBreakpoint(dbg, 5);
|
||||
|
||||
rightClickElement(dbg, "gutterElement", 5);
|
||||
await waitForContextMenu(dbg);
|
||||
ok(
|
||||
!findContextMenu(dbg, selectors.breakpointContextMenu.removeCondition),
|
||||
"Remove condition is not shown for a log point"
|
||||
);
|
||||
selectContextMenuItem(dbg, selectors.removeLogItem);
|
||||
await waitForState(dbg, () => {
|
||||
const breakpoint = findBreakpoint(dbg, "simple2.js", 5);
|
||||
return breakpoint && !breakpoint.options.logValue;
|
||||
});
|
||||
bp = findBreakpoint(dbg, "simple2.js", 5);
|
||||
is(bp.options.logValue, null, "The log value was removed");
|
||||
});
|
||||
|
||||
function waitForBreakpointWithoutCondition(dbg, url, line) {
|
||||
|
||||
@@ -1909,6 +1909,7 @@ const selectors = {
|
||||
"#node-menu-edit-condition, #node-menu-edit-conditional-breakpoint",
|
||||
addLogItem: "#node-menu-add-log-point",
|
||||
editLogItem: "#node-menu-edit-log-point",
|
||||
removeLogItem: "#node-menu-remove-log",
|
||||
disableItem: "#node-menu-disable-breakpoint",
|
||||
breakpoint: ".cm-gutter > .cm6-gutter-breakpoint",
|
||||
highlightLine: ".cm-content > .highlight-line",
|
||||
|
||||
Reference in new issue
Block a user