Bug 1630742 - cmd+click should continue to here. r=davidwalsh

Differential Revision: https://phabricator.services.mozilla.com/D71217
This commit is contained in:
Jason Laster 2020-04-22 01:07:05 +00:00
Родитель 09f0ec0bae
Коммит 97f6ed7aea
7 изменённых файлов: 49 добавлений и 9 удалений

Просмотреть файл

@ -21,6 +21,7 @@ const blacklist = [
"SET_FOCUSED_SOURCE_ITEM",
"NODE_EXPAND",
"IN_SCOPE_LINES",
"SET_PREVIEW",
];
function cloneAction(action: any) {

Просмотреть файл

@ -482,7 +482,11 @@ class Editor extends PureComponent<Props, State> {
}
if (ev.metaKey) {
return continueToHere(cx, sourceLine);
return continueToHere(cx, {
line: sourceLine,
column: undefined,
sourceId: selectedSource.id,
});
}
return addBreakpointAtLine(cx, sourceLine, ev.altKey, ev.shiftKey);

Просмотреть файл

@ -44,6 +44,8 @@ skip-if = debug # Window leaks: bug 1575332
[browser_dbg-browser-content-toolbox.js]
skip-if = !e10s || verify # This test is only valid in e10s
[browser_dbg-continue-to-here.js]
[browser_dbg-continue-to-here-click.js]
skip-if = debug
[browser_dbg-breakpoints-reloading.js]
[browser_dbg-breakpoint-skipping.js]
[browser_dbg-breakpoint-skipping-console.js]

Просмотреть файл

@ -0,0 +1,28 @@
/* 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/>. */
async function cmdClickLine(dbg, line) {
await cmdClickGutter(dbg, line);
return waitForPause(dbg);
}
async function waitForPause(dbg) {
await waitForDispatch(dbg, "RESUME");
await waitForPaused(dbg);
await waitForInlinePreviews(dbg);
}
add_task(async function() {
const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
await selectSource(dbg, "pause-points.js");
await waitForSelectedSource(dbg, "pause-points.js");
info("Test cmd+click continueing to a line");
clickElementInTab("#sequences");
await waitForPaused(dbg);
await waitForInlinePreviews(dbg);
await cmdClickLine(dbg, 31);
assertDebugLine(dbg, 31, 4);
await resume(dbg);
});

Просмотреть файл

@ -6,7 +6,8 @@ async function continueToLine(dbg, line) {
rightClickElement(dbg, "gutter", line);
selectContextMenuItem(dbg, selectors.editorContextMenu.continueToHere);
await waitForDispatch(dbg, "RESUME");
return waitForPaused(dbg);
await waitForPaused(dbg);
await waitForInlinePreviews(dbg);
}
async function continueToColumn(dbg, pos) {
@ -28,7 +29,7 @@ add_task(async function() {
await waitForPaused(dbg);
await waitForInlinePreviews(dbg);
await continueToColumn(dbg, { line: 31, ch: 7 });
await continueToLine(dbg, 31);
assertDebugLine(dbg, 31, 4);
await resume(dbg);
@ -38,7 +39,6 @@ add_task(async function() {
await waitForInlinePreviews(dbg);
await continueToColumn(dbg, { line: 31, ch: 7 });
assertDebugLine(dbg, 31, 4);
await resume(dbg);
});

Просмотреть файл

@ -44,7 +44,6 @@ Services.scriptloader.loadSubScript(
const EXAMPLE_URL =
"http://example.com/browser/devtools/client/debugger/test/mochitest/examples/";
// NOTE: still experimental, the screenshots might not be exactly correct
async function takeScreenshot(dbg) {
let canvas = dbg.win.document.createElementNS(

Просмотреть файл

@ -390,6 +390,7 @@ function assertDebugLine(dbg, line, column) {
ok(classMatch, "expression is highlighted as paused");
}
info(`Paused on line ${line}`);
}
/**
@ -1128,8 +1129,8 @@ const startKey = isMac
const keyMappings = {
close: { code: "w", modifiers: cmdOrCtrl },
commandKeyDown: {code: "VK_META", modifiers: {type: "keydown"}},
commandKeyUp: {code: "VK_META", modifiers: {type: "keyup"}},
commandKeyDown: { code: "VK_META", modifiers: { type: "keydown" } },
commandKeyUp: { code: "VK_META", modifiers: { type: "keyup" } },
debugger: { code: "s", modifiers: shiftOrAlt },
// test conditional panel shortcut
toggleCondPanel: { code: "b", modifiers: cmdShift },
@ -1444,8 +1445,8 @@ function clickElementWithSelector(dbg, selector) {
clickDOMElement(dbg, findElementWithSelector(dbg, selector));
}
function clickDOMElement(dbg, element) {
EventUtils.synthesizeMouseAtCenter(element, {}, dbg.win);
function clickDOMElement(dbg, element, options = {}) {
EventUtils.synthesizeMouseAtCenter(element, options, dbg.win);
}
function dblClickElement(dbg, elementName, ...args) {
@ -1491,6 +1492,11 @@ async function clickGutter(dbg, line) {
clickDOMElement(dbg, el);
}
async function cmdClickGutter(dbg, line) {
const el = await codeMirrorGutterElement(dbg, line);
clickDOMElement(dbg, el, cmdOrCtrl);
}
function findContextMenu(dbg, selector) {
// the context menu is in the toolbox window
const doc = dbg.toolbox.topDoc;