mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
Backed out 4 changesets (bug 1920928, bug 1900395, bug 1904489) for causing lint failures @ browser/app/profile/firefox.js CLOSED TREE
Backed out changeset 707bdf41cb27 (bug 1904489) Backed out changeset 7301dd63a389 (bug 1920928) Backed out changeset 374dce0b2a08 (bug 1900395) Backed out changeset f8e1ead1faa1 (bug 1900395)
This commit is contained in:
parent
41e0a1ea4d
commit
1e90e8f6b3
@ -3016,11 +3016,6 @@ pref("devtools.debugger.features.map-await-expression", true);
|
||||
pref("devtools.debugger.features.async-captured-stacks", true);
|
||||
pref("devtools.debugger.features.async-live-stacks", false);
|
||||
pref("devtools.debugger.hide-ignored-sources", false);
|
||||
#if defined(NIGHTLY_BUILD)
|
||||
pref("devtools.debugger.features.codemirror-next", true);
|
||||
#else
|
||||
pref("devtools.debugger.features.codemirror-next", false);
|
||||
#endif
|
||||
|
||||
// Disable autohide for DevTools popups and tooltips.
|
||||
// This is currently not exposed by any UI to avoid making
|
||||
|
@ -77,6 +77,8 @@ import {
|
||||
resizeBreakpointGutter,
|
||||
} from "../../utils/ui";
|
||||
|
||||
import flags from "devtools/shared/flags";
|
||||
|
||||
const { debounce } = require("resource://devtools/shared/debounce.js");
|
||||
const classnames = require("resource://devtools/client/shared/classnames.js");
|
||||
|
||||
@ -275,11 +277,9 @@ class Editor extends PureComponent {
|
||||
}
|
||||
this.setState({ editor });
|
||||
// Used for tests
|
||||
Object.defineProperty(window, "codeMirrorSourceEditorTestInstance", {
|
||||
get() {
|
||||
return editor;
|
||||
},
|
||||
});
|
||||
if (flags.testing) {
|
||||
window.codemirrorEditor = editor;
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,11 @@ function bindSelectors(obj) {
|
||||
}, {});
|
||||
}
|
||||
|
||||
function getCM() {
|
||||
const cm = document.querySelector(".CodeMirror");
|
||||
return cm?.CodeMirror;
|
||||
}
|
||||
|
||||
function formatMappedLocation(mappedLocation) {
|
||||
const { location, generatedLocation } = mappedLocation;
|
||||
return {
|
||||
@ -67,6 +72,7 @@ export function setupHelper(obj) {
|
||||
prefs,
|
||||
asyncStore,
|
||||
features,
|
||||
getCM,
|
||||
|
||||
// Expose this to tests as they don't have access to debugger's browser loader require
|
||||
// and so can't load utils/wasm.js
|
||||
|
@ -59,7 +59,7 @@ if (isNode()) {
|
||||
pref("devtools.debugger.features.log-points", true);
|
||||
pref("devtools.debugger.features.inline-preview", true);
|
||||
pref("devtools.debugger.features.javascript-tracing", false);
|
||||
pref("devtools.debugger.features.codemirror-next", true);
|
||||
pref("devtools.debugger.features.codemirror-next", false);
|
||||
pref("devtools.editor.tabsize", 2);
|
||||
pref("devtools.editor.expandtab", false);
|
||||
pref("devtools.editor.autoclosebrackets", false);
|
||||
|
@ -38,7 +38,7 @@ skip-if = ["asan"] # Bug 1591064
|
||||
["browser_dbg-blackbox-original.js"]
|
||||
|
||||
["browser_dbg-blackbox.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
fail-if = ["!cm6 && a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-breaking-from-console.js"]
|
||||
skip-if = ["debug"] # Window leaks: bug 1575332
|
||||
@ -52,12 +52,12 @@ skip-if = ["debug"] # Window leaks: bug 1575332
|
||||
["browser_dbg-breakpoints-actions.js"]
|
||||
|
||||
["browser_dbg-breakpoints-columns.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
fail-if = ["!cm6 && a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-breakpoints-cond-functional.js"]
|
||||
|
||||
["browser_dbg-breakpoints-cond-shortcut.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
fail-if = ["!cm6 && a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-breakpoints-cond-source-maps.js"]
|
||||
|
||||
@ -65,7 +65,7 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-breakpoints-debugger-statement.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
fail-if = ["!cm6 && a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-breakpoints-duplicate-functions.js"]
|
||||
|
||||
@ -117,14 +117,13 @@ skip-if = ["verify && !debug && os == 'linux'"]
|
||||
["browser_dbg-console-async.js"]
|
||||
|
||||
["browser_dbg-console-eval.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-console-link.js"]
|
||||
|
||||
["browser_dbg-console-map-bindings.js"]
|
||||
|
||||
["browser_dbg-console.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
fail-if = ["!cm6 && a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-content-script-sources.js"]
|
||||
skip-if = ["os == 'win' && ccov"] # Bug 1424154
|
||||
@ -134,7 +133,6 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
|
||||
skip-if = ["os == 'win'"]
|
||||
|
||||
["browser_dbg-continue-to-here.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-custom-formatters.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
@ -162,7 +160,7 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
|
||||
["browser_dbg-editor-mode.js"]
|
||||
|
||||
["browser_dbg-editor-scroll.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
fail-if = ["!cm6 && a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-editor-select.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1870062 clicked element may not be focusable and/or labeled
|
||||
@ -226,7 +224,6 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
|
||||
["browser_dbg-features-tabs.js"]
|
||||
|
||||
["browser_dbg-features-wasm.js"]
|
||||
skip-if = ["cm6"]
|
||||
|
||||
["browser_dbg-fission-frame-breakpoint.js"]
|
||||
skip-if = ["!fission"] # threads panel only shows remote frame when fission is enabled.
|
||||
|
@ -104,6 +104,7 @@ add_task(async function test_backgroundtask_debugger() {
|
||||
waitForState,
|
||||
waitUntil,
|
||||
createLocation,
|
||||
getCM,
|
||||
getEditorContent,
|
||||
getCMEditor,
|
||||
isCm6Enabled,
|
||||
|
@ -12,15 +12,12 @@ add_task(async function () {
|
||||
|
||||
await selectSource(dbg, "long.js");
|
||||
await waitForSelectedSource(dbg, "long.js");
|
||||
// Wait a bit for CM6 to complete any updates so the conditional panel
|
||||
// does not lose focus after the it has been opened
|
||||
await waitForDocumentLoadComplete(dbg);
|
||||
|
||||
info(
|
||||
"toggle conditional panel with shortcut: no breakpoints, default cursorPosition"
|
||||
);
|
||||
await pressKey(dbg, "toggleCondPanel");
|
||||
pressKey(dbg, "toggleCondPanel");
|
||||
await waitForConditionalPanelFocus(dbg);
|
||||
|
||||
ok(
|
||||
!!(await getConditionalPanelAtLine(dbg, 1)),
|
||||
"conditional panel panel is open on line 1"
|
||||
|
@ -37,6 +37,7 @@ add_task(async function () {
|
||||
createDebuggerContext,
|
||||
isWasmBinarySource,
|
||||
DEBUGGER_L10N,
|
||||
getCM,
|
||||
waitForState,
|
||||
waitForSelectedSource,
|
||||
createLocation,
|
||||
|
@ -19,10 +19,6 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function () {
|
||||
// Disabled for CM6 until this is fixed
|
||||
if (isCm6Enabled) {
|
||||
return;
|
||||
}
|
||||
// Load the test page before opening the debugger so that WASM are built
|
||||
// without debugging instructions. Opening the console still doesn't enable debugging instructions.
|
||||
const tab = await addTab(EXAMPLE_URL + "doc-wasm-sourcemaps.html");
|
||||
|
@ -7,10 +7,6 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function () {
|
||||
// Disabled for CM6 until this is fixed
|
||||
if (isCm6Enabled) {
|
||||
return;
|
||||
}
|
||||
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
|
||||
const doc = dbg.win.document;
|
||||
|
||||
|
@ -8,10 +8,6 @@
|
||||
|
||||
// Tests that after clicking a function in edtior, outline focuses that function
|
||||
add_task(async function () {
|
||||
// Disabled for CM6 until this is fixed
|
||||
if (isCm6Enabled) {
|
||||
return;
|
||||
}
|
||||
const dbg = await initDebugger("doc-sources.html", "long.js");
|
||||
|
||||
await selectSource(dbg, "long.js", 1);
|
||||
|
@ -207,7 +207,7 @@ async function testHoveringInvalidTargetTokens(dbg) {
|
||||
// We don't want to use hoverToken, as it synthesize the event at the center of the element,
|
||||
// which wouldn't reproduce the original issue we want to check
|
||||
EventUtils.synthesizeMouse(
|
||||
findElement(dbg, "CodeMirrorLines"),
|
||||
findElementWithSelector(dbg, ".CodeMirror-lines"),
|
||||
0,
|
||||
0,
|
||||
{
|
||||
@ -218,7 +218,7 @@ async function testHoveringInvalidTargetTokens(dbg) {
|
||||
is(
|
||||
await racePromiseLines,
|
||||
"TIMEOUT_LINES",
|
||||
"No popup was displayed over the content container element"
|
||||
"No popup was displayed over the .CodeMirror-lines element"
|
||||
);
|
||||
|
||||
// Resume and select back the main JS file that is used by the other assertions
|
||||
|
@ -23,7 +23,6 @@ prefs = [
|
||||
]
|
||||
|
||||
["browser_dbg-keyboard-navigation.js"]
|
||||
skip-if = ["cm6"]
|
||||
|
||||
["browser_dbg-keyboard-shortcuts-modal.js"]
|
||||
|
||||
@ -77,7 +76,7 @@ skip-if = [
|
||||
|
||||
["browser_dbg-outline-focus.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
skip-if = ["verify", "cm6"]
|
||||
skip-if = ["verify"]
|
||||
|
||||
["browser_dbg-outline-pretty.js"]
|
||||
|
||||
@ -107,7 +106,6 @@ skip-if = ["os == 'win'"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-pretty-print-breakpoints-delete.js"]
|
||||
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
|
||||
|
||||
["browser_dbg-pretty-print-breakpoints.js"]
|
||||
|
||||
|
@ -1618,7 +1618,11 @@ async function selectEditorLinesAndOpenContextMenu(
|
||||
elementName = "line"
|
||||
) {
|
||||
const { startLine, endLine } = lines;
|
||||
setSelection(dbg, startLine, endLine ?? startLine);
|
||||
if (!endLine) {
|
||||
await clickElement(dbg, elementName, startLine);
|
||||
} else {
|
||||
setSelection(dbg, startLine, endLine);
|
||||
}
|
||||
return openContextMenuInDebugger(dbg, elementName, startLine);
|
||||
}
|
||||
|
||||
@ -2226,7 +2230,7 @@ function rightClickObjectInspectorNode(dbg, node) {
|
||||
|
||||
// Gets the current source editor for CM6 tests
|
||||
function getCMEditor(dbg) {
|
||||
return dbg.win.codeMirrorSourceEditorTestInstance;
|
||||
return dbg.win.codemirrorEditor;
|
||||
}
|
||||
|
||||
// Gets the number of lines in the editor
|
||||
@ -2241,15 +2245,6 @@ function waitForSearchState(dbg) {
|
||||
return waitFor(() => getCMEditor(dbg).isSearchStateReady());
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for CodeMirror Document to completely load (for CM6 only)
|
||||
*/
|
||||
function waitForDocumentLoadComplete(dbg) {
|
||||
return waitFor(() =>
|
||||
isCm6Enabled ? getCMEditor(dbg).codeMirror.isDocumentLoadComplete : true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the content for the editor as a string. it uses the
|
||||
* newline character to separate lines.
|
||||
@ -2288,6 +2283,12 @@ async function scrollEditorIntoView(dbg, line, column) {
|
||||
return onScrolled;
|
||||
}
|
||||
|
||||
// Gets the current codeMirror instance for CM5 tests
|
||||
function getCM(dbg) {
|
||||
const el = dbg.win.document.querySelector(".CodeMirror");
|
||||
return el.CodeMirror;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around source editor api to check if a scrolled position is visible
|
||||
*
|
||||
@ -2327,6 +2328,7 @@ function getCoordsFromPosition(dbg, line, ch) {
|
||||
|
||||
async function getTokenFromPosition(dbg, { line, column = 0 }) {
|
||||
info(`Get token at ${line}:${column}`);
|
||||
const cm = getCM(dbg);
|
||||
line = isCm6Enabled ? line : line - 1;
|
||||
column = isCm6Enabled ? column : column - 1;
|
||||
await scrollEditorIntoView(dbg, line, column);
|
||||
@ -2373,6 +2375,7 @@ async function waitForScrolling(dbg, { useTimeoutFallback = true } = {}) {
|
||||
|
||||
async function codeMirrorGutterElement(dbg, line) {
|
||||
info(`CodeMirror line ${line}`);
|
||||
const cm = getCM(dbg);
|
||||
|
||||
line = isCm6Enabled ? line : line - 1;
|
||||
await scrollEditorIntoView(dbg, line, 0);
|
||||
@ -2596,9 +2599,7 @@ async function tryHovering(dbg, line, column, elementName) {
|
||||
async function tryHoverTokenAtLine(dbg, expression, line, column, elementName) {
|
||||
info("Scroll codeMirror to make the token visible");
|
||||
await scrollEditorIntoView(dbg, line, 0);
|
||||
// Wait for all the updates to the document to complete to make all
|
||||
// token elements have been rendered
|
||||
await waitForDocumentLoadComplete(dbg);
|
||||
|
||||
// Lookup for the token matching the passed expression
|
||||
const tokenEl = await getTokenElAtLine(dbg, expression, line, column);
|
||||
if (!tokenEl) {
|
||||
|
@ -3113,9 +3113,6 @@ Toolbox.prototype = {
|
||||
}
|
||||
|
||||
return this.loadTool("webconsole").then(() => {
|
||||
if (!this.component) {
|
||||
return;
|
||||
}
|
||||
this.component.setIsSplitConsoleActive(true);
|
||||
this.telemetry.recordEvent("activate", "split_console", null, {
|
||||
host: this._getTelemetryHostString(),
|
||||
|
@ -60,4 +60,5 @@ pref("devtools.debugger.features.map-expression-bindings", true);
|
||||
pref("devtools.debugger.features.log-points", true);
|
||||
pref("devtools.debugger.features.inline-preview", true);
|
||||
pref("devtools.debugger.features.javascript-tracing", false);
|
||||
pref("devtools.debugger.features.codemirror-next", false);
|
||||
pref("devtools.debugger.features.overlay", true);
|
||||
|
@ -1732,9 +1732,6 @@ class Editor extends EventEmitter {
|
||||
* @returns {Object} - The location information for the current viewport
|
||||
*/
|
||||
getLocationsInViewport() {
|
||||
if (this.isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
const cm = editors.get(this);
|
||||
if (this.config.cm6) {
|
||||
const { from, to } = cm.viewport;
|
||||
@ -2094,13 +2091,18 @@ class Editor extends EventEmitter {
|
||||
/**
|
||||
* Gets details about the line
|
||||
*
|
||||
* @param {Number} line
|
||||
* @param {Number} lineOrOffset
|
||||
* @returns {Object} line info object
|
||||
*/
|
||||
lineInfo(line) {
|
||||
lineInfo(lineOrOffset) {
|
||||
let line = this.toLineIfWasmOffset(lineOrOffset);
|
||||
if (line == undefined) {
|
||||
return null;
|
||||
}
|
||||
const cm = editors.get(this);
|
||||
if (this.config.cm6) {
|
||||
// cm6 lines are 1-based, while cm5 are 0-based
|
||||
line = line + 1;
|
||||
const el = this.getElementAtLine(line);
|
||||
// Filter out SPAN which do not contain user-defined classes.
|
||||
// Classes currently are "debug-expression" and "debug-expression-error"
|
||||
@ -2109,7 +2111,7 @@ class Editor extends EventEmitter {
|
||||
);
|
||||
|
||||
return {
|
||||
text: el.innerText,
|
||||
text: cm.state.doc.lineAt(line)?.text,
|
||||
// TODO: Expose those, or see usage for those and do things differently
|
||||
line: null,
|
||||
handle: {
|
||||
|
@ -2212,11 +2212,6 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
- name: devtools.debugger.features.codemirror-next
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "docshell."
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -3429,9 +3429,7 @@ toolbar#nav-bar {
|
||||
"android_version": mozinfo.info.get("android_version", -1),
|
||||
"android": mozinfo.info.get("android", False),
|
||||
"is_emulator": mozinfo.info.get("is_emulator", False),
|
||||
"cm6": self.extraPrefs.get(
|
||||
"devtools.debugger.features.codemirror-next", False
|
||||
),
|
||||
"cm6": mozinfo.info.get("cm6", False),
|
||||
"coverage": mozinfo.info.get("coverage", False),
|
||||
}
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ const {
|
||||
const {
|
||||
createContext,
|
||||
findSource,
|
||||
getCMEditor,
|
||||
getCM,
|
||||
hoverOnToken,
|
||||
openDebuggerAndLog,
|
||||
pauseDebugger,
|
||||
@ -55,7 +55,7 @@ module.exports = async function () {
|
||||
|
||||
const tab = await testSetup(TEST_URL, { disableCache: true });
|
||||
|
||||
const toolbox = await openDebuggerAndLog("custom", EXPECTED);
|
||||
const toolbox = await openDebuggerAndLog("custom", EXPECTED, isCm6Enabled);
|
||||
|
||||
dump("Waiting for debugger panel\n");
|
||||
const panel = await toolbox.getPanelWhenReady("jsdebugger");
|
||||
@ -66,7 +66,7 @@ module.exports = async function () {
|
||||
// Reselect App.js as that's the source expected to be selected after page reload
|
||||
await selectSource(dbg, EXPECTED.file);
|
||||
|
||||
await reloadDebuggerAndLog("custom", toolbox, EXPECTED);
|
||||
await reloadDebuggerAndLog("custom", toolbox, EXPECTED, isCm6Enabled);
|
||||
|
||||
// these tests are only run on custom.jsdebugger
|
||||
await pauseDebuggerAndLog(dbg, tab, EXPECTED_FUNCTION);
|
||||
@ -216,7 +216,7 @@ async function testPreview(dbg, tab, testFunction, isCm6Enabled) {
|
||||
await garbageCollect();
|
||||
}
|
||||
|
||||
async function testOpeningLargeMinifiedFile(dbg) {
|
||||
async function testOpeningLargeMinifiedFile(dbg, isCm6Enabled) {
|
||||
dump("Executing opening large minified test ...\n");
|
||||
const fileFirstMinifiedChars = `(()=>{var e,t,n,r,o={82603`;
|
||||
|
||||
@ -226,7 +226,7 @@ async function testOpeningLargeMinifiedFile(dbg) {
|
||||
);
|
||||
const test = runTest("custom.jsdebugger.open-large-minified-file.DAMP");
|
||||
const onSelected = selectSource(dbg, MINIFIED_URL);
|
||||
await waitForText(dbg, fileFirstMinifiedChars);
|
||||
await waitForText(dbg, fileFirstMinifiedChars, isCm6Enabled);
|
||||
test.done();
|
||||
await onSelected;
|
||||
fullTest.done();
|
||||
@ -247,16 +247,15 @@ async function testPrettyPrint(dbg, toolbox, isCm6Enabled) {
|
||||
await selectSource(dbg, MINIFIED_URL);
|
||||
|
||||
dump("Wait until CodeMirror highlighting is done\n");
|
||||
const cm = getCMEditor(dbg).codeMirror;
|
||||
const cm = getCM(dbg, isCm6Enabled);
|
||||
await waitUntil(() => {
|
||||
if (isCm6Enabled) {
|
||||
return true;
|
||||
}
|
||||
// For CM5 highlightFrontier is not documented but is an internal variable indicating the current
|
||||
// line that was just highlighted. This document has only 2 lines, so wait until both
|
||||
// are highlighted. Since there was an other document opened before, we need to do an
|
||||
// exact check to properly wait.
|
||||
return cm.doc.highlightFrontier === 2;
|
||||
return isCm6Enabled
|
||||
? cm.isDocumentLoadComplete
|
||||
: // For CM5 highlightFrontier is not documented but is an internal variable indicating the current
|
||||
// line that was just highlighted. This document has only 2 lines, so wait until both
|
||||
// are highlighted. Since there was an other document opened before, we need to do an
|
||||
// exact check to properly wait.
|
||||
cm.doc.highlightFrontier === 2;
|
||||
});
|
||||
|
||||
const prettyPrintButton = await waitUntil(() => {
|
||||
@ -267,7 +266,7 @@ async function testPrettyPrint(dbg, toolbox, isCm6Enabled) {
|
||||
const test = runTest("custom.jsdebugger.pretty-print.DAMP");
|
||||
prettyPrintButton.click();
|
||||
await waitForSource(dbg, formattedFileUrl);
|
||||
await waitForText(dbg, filePrettyChars);
|
||||
await waitForText(dbg, filePrettyChars, isCm6Enabled);
|
||||
test.done();
|
||||
|
||||
await addBreakpoint(dbg, 776, formattedFileUrl);
|
||||
@ -276,12 +275,17 @@ async function testPrettyPrint(dbg, toolbox, isCm6Enabled) {
|
||||
const reloadAndPauseInPrettyPrintedFileTest = runTest(
|
||||
"custom.jsdebugger.pretty-print.reload-and-pause.DAMP"
|
||||
);
|
||||
await reloadDebuggerAndLog("custom.pretty-print", toolbox, {
|
||||
sources: 1105,
|
||||
sourceURL: formattedFileUrl,
|
||||
text: filePrettyChars,
|
||||
threadsCount: EXPECTED.threadsCount,
|
||||
});
|
||||
await reloadDebuggerAndLog(
|
||||
"custom.pretty-print",
|
||||
toolbox,
|
||||
{
|
||||
sources: 1105,
|
||||
sourceURL: formattedFileUrl,
|
||||
text: filePrettyChars,
|
||||
threadsCount: EXPECTED.threadsCount,
|
||||
},
|
||||
isCm6Enabled
|
||||
);
|
||||
await onPaused;
|
||||
|
||||
// When reloading, the `togglePrettyPrint` action is called to pretty print the minified source.
|
||||
|
@ -102,20 +102,32 @@ function findSource(dbg, url) {
|
||||
}
|
||||
exports.findSource = findSource;
|
||||
|
||||
function getCMEditor(dbg) {
|
||||
return dbg.win.codeMirrorSourceEditorTestInstance;
|
||||
function getCM(dbg, isCm6Enabled) {
|
||||
if (isCm6Enabled) {
|
||||
return dbg.win.document.sourceEditor.cm;
|
||||
}
|
||||
const el = dbg.win.document.querySelector(".CodeMirror");
|
||||
return el.CodeMirror;
|
||||
}
|
||||
exports.getCMEditor = getCMEditor;
|
||||
exports.getCM = getCM;
|
||||
|
||||
function waitForText(dbg, text) {
|
||||
function waitForText(dbg, text, isCm6Enabled = false) {
|
||||
return waitUntil(() => {
|
||||
// the welcome box is removed once text is displayed
|
||||
const welcomebox = dbg.win.document.querySelector(".welcomebox");
|
||||
if (welcomebox) {
|
||||
return false;
|
||||
}
|
||||
const editor = getCMEditor(dbg);
|
||||
return editor.getText().includes(text);
|
||||
const cm = getCM(dbg, isCm6Enabled);
|
||||
let editorText = "";
|
||||
if (isCm6Enabled) {
|
||||
if (cm) {
|
||||
editorText = cm.state.doc.toString();
|
||||
}
|
||||
} else {
|
||||
editorText = cm.doc.getValue();
|
||||
}
|
||||
return editorText.includes(text);
|
||||
}, "text is visible");
|
||||
}
|
||||
exports.waitForText = waitForText;
|
||||
@ -284,13 +296,13 @@ function evalInFrame(tab, testFunction) {
|
||||
}
|
||||
exports.evalInFrame = evalInFrame;
|
||||
|
||||
async function openDebuggerAndLog(label, expected) {
|
||||
async function openDebuggerAndLog(label, expected, isCm6Enabled) {
|
||||
const onLoad = async (toolbox, panel) => {
|
||||
const dbg = await createContext(panel);
|
||||
await waitForThreadCount(dbg, expected.threadsCount);
|
||||
await waitForSource(dbg, expected.sourceURL);
|
||||
await selectSource(dbg, expected.file);
|
||||
await waitForText(dbg, expected.text);
|
||||
await waitForText(dbg, expected.text, isCm6Enabled);
|
||||
};
|
||||
|
||||
const toolbox = await openToolboxAndLog(
|
||||
@ -302,7 +314,7 @@ async function openDebuggerAndLog(label, expected) {
|
||||
}
|
||||
exports.openDebuggerAndLog = openDebuggerAndLog;
|
||||
|
||||
async function reloadDebuggerAndLog(label, toolbox, expected) {
|
||||
async function reloadDebuggerAndLog(label, toolbox, expected, isCm6Enabled) {
|
||||
const onReload = async () => {
|
||||
const panel = await toolbox.getPanelWhenReady("jsdebugger");
|
||||
const dbg = await createContext(panel);
|
||||
@ -315,7 +327,7 @@ async function reloadDebuggerAndLog(label, toolbox, expected) {
|
||||
|
||||
await waitForSources(dbg, expected.sources);
|
||||
await waitForSource(dbg, expected.sourceURL);
|
||||
await waitForText(dbg, expected.text);
|
||||
await waitForText(dbg, expected.text, isCm6Enabled);
|
||||
};
|
||||
await reloadPageAndLog(`${label}.jsdebugger`, toolbox, onReload);
|
||||
}
|
||||
@ -389,7 +401,7 @@ async function step(dbg, stepType) {
|
||||
exports.step = step;
|
||||
|
||||
async function hoverOnToken(dbg, textToWaitFor, textToHover, isCm6Enabled) {
|
||||
await waitForText(dbg, textToWaitFor);
|
||||
await waitForText(dbg, textToWaitFor, isCm6Enabled);
|
||||
const selector = isCm6Enabled ? ".cm-editor span" : ".CodeMirror span";
|
||||
const tokenElement = [...dbg.win.document.querySelectorAll(selector)].find(
|
||||
el => el.textContent === textToHover
|
||||
|
Loading…
x
Reference in New Issue
Block a user