diff --git a/devtools/client/debugger/src/components/Editor/menus/editor.js b/devtools/client/debugger/src/components/Editor/menus/editor.js index c8910257484b7..5ed3c96f6f990 100644 --- a/devtools/client/debugger/src/components/Editor/menus/editor.js +++ b/devtools/client/debugger/src/components/Editor/menus/editor.js @@ -131,15 +131,17 @@ export const blackBoxLineMenuItem = ( ? blackboxRange.start.line == blackboxRange.end.line : startLine == endLine; + const isSourceFullyBlackboxed = + blackboxedRanges[selectedSource.url] && + !blackboxedRanges[selectedSource.url].length; + // The ignore/unignore line context menu item should be disabled when // 1) The source is on the sourcemap ignore list // 2) The whole source is blackboxed or // 3) Multiple lines are blackboxed or // 4) Multiple lines are selected in the editor const shouldDisable = - isSourceOnIgnoreList || - !blackboxedRanges[selectedSource.url]?.length || - !isSingleLine; + isSourceOnIgnoreList || isSourceFullyBlackboxed || !isSingleLine; return { id: "node-menu-blackbox-line", diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-blackbox.js b/devtools/client/debugger/test/mochitest/browser_dbg-blackbox.js index af48aa2a31750..9542473408f29 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-blackbox.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-blackbox.js @@ -490,6 +490,17 @@ async function resumeAndWaitForPauseCounter(dbg) { ); } +async function assertContextMenuDisabled(dbg, selector, shouldBeDisabled) { + const item = await waitFor(() => findContextMenu(dbg, selector)); + is( + item.disabled, + shouldBeDisabled, + `The the context menu item is ${ + shouldBeDisabled ? "disabled" : "not disabled" + }` + ); +} + /** * Asserts that the gutter blackbox context menu items which are visible are correct * @params {Object} dbg @@ -517,6 +528,11 @@ async function assertGutterBlackBoxBoxContextMenuItems(dbg, testFixtures) { : contextMenuItems.unignoreLine; await assertContextMenuLabel(dbg, item.selector, item.label); + await assertContextMenuDisabled( + dbg, + item.selector, + blackboxedSourceState == SOURCE_IS_FULLY_IGNORED + ); await closeContextMenu(dbg, popup); } @@ -531,7 +547,7 @@ async function assertGutterBlackBoxBoxContextMenuItems(dbg, testFixtures) { ); const item = contextMenuItems.ignoreLine; await assertContextMenuLabel(dbg, item.selector, item.label); - + await assertContextMenuDisabled(dbg, item.selector, false); await closeContextMenu(dbg, popup); } }