зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543821 - Mochitests should use dbg helper. r=davidwalsh
Differential Revision: https://phabricator.services.mozilla.com/D27168 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
da68d6846c
Коммит
37f00546fc
|
@ -21,6 +21,7 @@
|
|||
"is": false,
|
||||
"isnot": false,
|
||||
"ok": false,
|
||||
"once": false,
|
||||
"registerCleanupFunction": false,
|
||||
"requestLongerTimeout": false,
|
||||
"SimpleTest": false,
|
||||
|
@ -71,7 +72,9 @@
|
|||
"assertEditorBreakpoint": false,
|
||||
"assertBreakpointSnippet": false,
|
||||
"assertEmptyLines": false,
|
||||
"assertPaused": false,
|
||||
"assertPausedLocation": false,
|
||||
"assertPreviewTextValue": false,
|
||||
"assertHighlightLocation": false,
|
||||
"createDebuggerContext": false,
|
||||
"initDebugger": false,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Tests the breakpoints are hit in various situations.
|
||||
|
||||
|
@ -25,12 +26,12 @@ add_task(async function() {
|
|||
assertPausedLocation(dbg);
|
||||
await resume(dbg);
|
||||
|
||||
info('Create an eval script that pauses itself.')
|
||||
info("Create an eval script that pauses itself.");
|
||||
invokeInTab("doEval");
|
||||
await waitForPaused(dbg);
|
||||
|
||||
await resume(dbg);
|
||||
const source = getSelectedSource(getState())
|
||||
const source = getSelectedSource();
|
||||
ok(!source.url, "It is an eval source");
|
||||
|
||||
await addBreakpoint(dbg, source, 5);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
function skipPausing(dbg) {
|
||||
clickElementWithSelector(dbg, ".command-bar-skip-pausing");
|
||||
return waitForState(dbg, state => dbg.selectors.getSkipPausing(state))
|
||||
return waitForState(dbg, state => dbg.selectors.getSkipPausing());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -12,8 +13,8 @@ function skipPausing(dbg) {
|
|||
*/
|
||||
|
||||
add_task(async function() {
|
||||
let dbg = await initDebugger("doc-scripts.html");
|
||||
await selectSource(dbg, "simple3")
|
||||
const dbg = await initDebugger("doc-scripts.html");
|
||||
await selectSource(dbg, "simple3");
|
||||
await addBreakpoint(dbg, "simple3", 2);
|
||||
|
||||
await skipPausing(dbg);
|
||||
|
|
|
@ -18,10 +18,7 @@ add_task(async function() {
|
|||
// select "Remove breakpoint"
|
||||
selectContextMenuItem(dbg, selectors.breakpointContextMenu.remove);
|
||||
|
||||
await waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getBreakpointCount(state) === 0
|
||||
);
|
||||
await waitForState(dbg, state => dbg.selectors.getBreakpointCount() === 0);
|
||||
ok("successfully removed the breakpoint");
|
||||
});
|
||||
|
||||
|
@ -46,7 +43,7 @@ add_task(async function() {
|
|||
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableOthers);
|
||||
await waitForState(dbg, state =>
|
||||
dbg.selectors
|
||||
.getBreakpointsList(state)
|
||||
.getBreakpointsList()
|
||||
.every(bp => (bp.location.line !== 4) === bp.disabled)
|
||||
);
|
||||
await dispatched;
|
||||
|
@ -57,7 +54,7 @@ add_task(async function() {
|
|||
dispatched = waitForDispatch(dbg, "SET_BREAKPOINT");
|
||||
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableAll);
|
||||
await waitForState(dbg, state =>
|
||||
dbg.selectors.getBreakpointsList(state).every(bp => bp.disabled)
|
||||
dbg.selectors.getBreakpointsList().every(bp => bp.disabled)
|
||||
);
|
||||
await dispatched;
|
||||
ok("all breakpoints are disabled");
|
||||
|
@ -68,7 +65,7 @@ add_task(async function() {
|
|||
selectContextMenuItem(dbg, selectors.breakpointContextMenu.enableOthers);
|
||||
await waitForState(dbg, state =>
|
||||
dbg.selectors
|
||||
.getBreakpointsList(state)
|
||||
.getBreakpointsList()
|
||||
.every(bp => (bp.location.line === 4) === bp.disabled)
|
||||
);
|
||||
await dispatched;
|
||||
|
@ -81,8 +78,8 @@ add_task(async function() {
|
|||
await waitForState(
|
||||
dbg,
|
||||
state =>
|
||||
dbg.selectors.getBreakpointsList(state).length === 1 &&
|
||||
dbg.selectors.getBreakpointsList(state)[0].location.line === 4
|
||||
dbg.selectors.getBreakpointsList().length === 1 &&
|
||||
dbg.selectors.getBreakpointsList()[0].location.line === 4
|
||||
);
|
||||
await dispatched;
|
||||
ok("remaining breakpoint should be on line 4");
|
||||
|
|
|
@ -51,7 +51,7 @@ async function disableBreakpoint(dbg, index) {
|
|||
selectContextMenuItem(dbg, selectors.disableItem);
|
||||
|
||||
await waitForState(dbg, state => {
|
||||
const bp = dbg.selectors.getBreakpointsList(state)[index];
|
||||
const bp = dbg.selectors.getBreakpointsList()[index];
|
||||
return bp.disabled;
|
||||
});
|
||||
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
function firstBreakpoint(dbg) {
|
||||
return dbg.selectors.getBreakpointsList(dbg.getState())[0];
|
||||
return dbg.selectors.getBreakpointsList()[0];
|
||||
}
|
||||
|
||||
// tests to make sure we do not accidentally slide the breakpoint up to the first
|
||||
// function with the same name in the file.
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-duplicate-functions.html", "doc-duplicate-functions");
|
||||
const dbg = await initDebugger(
|
||||
"doc-duplicate-functions.html",
|
||||
"doc-duplicate-functions"
|
||||
);
|
||||
const source = findSource(dbg, "doc-duplicate-functions");
|
||||
|
||||
await selectSource(dbg, source.url);
|
||||
await addBreakpoint(dbg, source.url, 19);
|
||||
|
||||
await reload(dbg, source.url);
|
||||
await waitForState(dbg, state => dbg.selectors.getBreakpointCount(state) == 1);
|
||||
await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 1);
|
||||
is(firstBreakpoint(dbg).location.line, 19, "Breakpoint is on line 19");
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// checks to see if the frame is selected and the title is correct
|
||||
function isFrameSelected(dbg, index, title) {
|
||||
|
@ -7,10 +8,10 @@ function isFrameSelected(dbg, index, title) {
|
|||
|
||||
const {
|
||||
selectors: { getSelectedFrame, getCurrentThread },
|
||||
getState,
|
||||
getState
|
||||
} = dbg;
|
||||
|
||||
const frame = getSelectedFrame(getState(), getCurrentThread(getState()));
|
||||
const frame = getSelectedFrame(getCurrentThread());
|
||||
|
||||
const elSelected = $frame.classList.contains("selected");
|
||||
const titleSelected = frame.displayName == title;
|
||||
|
@ -31,17 +32,18 @@ function createMockAngularPage() {
|
|||
httpServer.registerContentType("html", "text/html");
|
||||
httpServer.registerContentType("js", "application/javascript");
|
||||
|
||||
const htmlFilename = "angular-mock.html"
|
||||
httpServer.registerPathHandler(`/${htmlFilename}`, function(request, response) {
|
||||
const htmlFilename = "angular-mock.html";
|
||||
httpServer.registerPathHandler(`/${htmlFilename}`, function(
|
||||
request,
|
||||
response
|
||||
) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
response.write(`
|
||||
<html>
|
||||
<button class="pause">Click me</button>
|
||||
<script type="text/javascript" src="angular.js"></script>
|
||||
</html>`
|
||||
);
|
||||
}
|
||||
);
|
||||
</html>`);
|
||||
});
|
||||
|
||||
// Register an angular.js file in order to create a Group with anonymous functions in
|
||||
// the callstack panel.
|
||||
|
@ -70,7 +72,7 @@ add_task(async function() {
|
|||
await waitForPaused(dbg);
|
||||
ok(isFrameSelected(dbg, 1, "secondCall"), "the first frame is selected");
|
||||
|
||||
let button = toggleButton(dbg);
|
||||
const button = toggleButton(dbg);
|
||||
ok(!button, "toggle button shouldn't be there");
|
||||
});
|
||||
|
||||
|
@ -96,7 +98,6 @@ add_task(async function() {
|
|||
await waitForSelectedSource(dbg, "frames.js");
|
||||
});
|
||||
|
||||
|
||||
add_task(async function() {
|
||||
const url = createMockAngularPage();
|
||||
const tab = await addTab(url);
|
||||
|
@ -113,7 +114,14 @@ add_task(async function() {
|
|||
|
||||
await waitForPaused(dbg);
|
||||
const $group = findElementWithSelector(dbg, ".frames .frames-group");
|
||||
is($group.querySelector(".badge").textContent, "2", "Group has expected badge");
|
||||
is($group.querySelector(".group-description-name").textContent, "Angular",
|
||||
"Group has expected location");
|
||||
is(
|
||||
$group.querySelector(".badge").textContent,
|
||||
"2",
|
||||
"Group has expected badge"
|
||||
);
|
||||
is(
|
||||
$group.querySelector(".group-description-name").textContent,
|
||||
"Angular",
|
||||
"Group has expected location"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -27,12 +27,12 @@ add_task(async function() {
|
|||
// Make sure that clicking the gutter creates a breakpoint icon.
|
||||
clickGutter(dbg, 4);
|
||||
await waitForDispatch(dbg, "SET_BREAKPOINT");
|
||||
is(dbg.selectors.getBreakpointCount(getState()), 1, "One breakpoint exists");
|
||||
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
|
||||
await assertEditorBreakpoint(dbg, 4, true);
|
||||
|
||||
// Make sure clicking at the same place removes the icon.
|
||||
clickGutter(dbg, 4);
|
||||
await waitForDispatch(dbg, "REMOVE_BREAKPOINT");
|
||||
is(dbg.selectors.getBreakpointCount(getState()), 0, "No breakpoints exist");
|
||||
is(dbg.selectors.getBreakpointCount(), 0, "No breakpoints exist");
|
||||
await assertEditorBreakpoint(dbg, 4, false);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Tests that the editor will always highight the right line, no
|
||||
// matter if the source text doesn't exist yet or even if the source
|
||||
|
@ -11,7 +12,7 @@ add_task(async function() {
|
|||
selectors: { getSource },
|
||||
getState
|
||||
} = dbg;
|
||||
const sourceUrl = EXAMPLE_URL + "long.js";
|
||||
const sourceUrl = `${EXAMPLE_URL}long.js`;
|
||||
|
||||
// The source itself doesn't even exist yet, and using
|
||||
// `selectSourceURL` will set a pending request to load this source
|
||||
|
@ -22,27 +23,27 @@ add_task(async function() {
|
|||
// TODO: revisit highlighting lines when the debugger opens
|
||||
// assertHighlightLocation(dbg, "long.js", 66);
|
||||
|
||||
log(`Select line 16 and make sure the editor scrolled.`);
|
||||
log("Select line 16 and make sure the editor scrolled.");
|
||||
await selectSource(dbg, "long.js", 16);
|
||||
await waitForElementWithSelector(dbg, ".CodeMirror-code > .highlight-line");
|
||||
assertHighlightLocation(dbg, "long.js", 16);
|
||||
|
||||
log(`Select several locations and check that we have one highlight`);
|
||||
log("Select several locations and check that we have one highlight");
|
||||
await selectSource(dbg, "long.js", 17);
|
||||
await selectSource(dbg, "long.js", 18);
|
||||
assertHighlightLocation(dbg, "long.js", 18);
|
||||
|
||||
// Test jumping to a line in a source that exists but hasn't been
|
||||
// loaded yet.
|
||||
log(`Select an unloaded source`);
|
||||
log("Select an unloaded source");
|
||||
selectSource(dbg, "simple1.js", 6);
|
||||
|
||||
// Make sure the source is in the loading state, wait for it to be
|
||||
// fully loaded, and check the highlighted line.
|
||||
const simple1 = findSource(dbg, "simple1.js");
|
||||
is(getSource(getState(), simple1.id).loadedState, "loading");
|
||||
is(getSource(simple1.id).loadedState, "loading");
|
||||
|
||||
await waitForSelectedSource(dbg, "simple1.js");
|
||||
ok(getSource(getState(), simple1.id).text);
|
||||
ok(getSource(simple1.id).text);
|
||||
assertHighlightLocation(dbg, "simple1.js", 6);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Test that exceptions thrown while evaluating code will pause at the point the
|
||||
// exception was generated when pausing on uncaught exceptions.
|
||||
|
@ -8,10 +9,7 @@ add_task(async function() {
|
|||
await togglePauseOnExceptions(dbg, true, true);
|
||||
|
||||
invokeInTab("evaluateException");
|
||||
|
||||
await waitForPaused(dbg);
|
||||
|
||||
const state = dbg.store.getState();
|
||||
const source = dbg.selectors.getSelectedSource(state);
|
||||
const source = dbg.selectors.getSelectedSource();
|
||||
ok(!source.url, "Selected source should not have a URL");
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Test that pausing within an event handler on an element does *not* show the
|
||||
// HTML page containing that element. It should show a sources tab containing
|
||||
|
@ -8,10 +9,7 @@ add_task(async function() {
|
|||
const dbg = await initDebugger("doc-event-handler.html");
|
||||
|
||||
invokeInTab("synthesizeClick");
|
||||
|
||||
await waitForPaused(dbg);
|
||||
|
||||
const state = dbg.store.getState();
|
||||
const source = dbg.selectors.getSelectedSource(state);
|
||||
const source = dbg.selectors.getSelectedSource();
|
||||
ok(!source.url, "Selected source should not have a URL");
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
/**
|
||||
* This if the debugger's layout is correctly modified when the toolbox's
|
||||
|
@ -29,14 +30,13 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
async function testLayout(dbg, orientation, host) {
|
||||
const { panel, toolbox } = dbg;
|
||||
info(`Switching to ${host} ${orientation}.`);
|
||||
|
||||
await switchHost(dbg, host);
|
||||
await resizeToolboxWindow(dbg, host);
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getOrientation(state) == orientation
|
||||
state => dbg.selectors.getOrientation() == orientation
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
function countSources(dbg) {
|
||||
return dbg.selectors.getSourceCount(dbg.getState());
|
||||
return dbg.selectors.getSourceCount();
|
||||
}
|
||||
|
||||
const sources = [
|
||||
|
@ -41,7 +41,7 @@ add_task(async function() {
|
|||
|
||||
await navigate(dbg, "doc-scripts.html", ...sources);
|
||||
is(countSources(dbg), 5, "5 sources are loaded.");
|
||||
ok(!getIsPaused(getState(), getCurrentThread(getState())), "Is not paused");
|
||||
ok(!getIsPaused(getCurrentThread()), "Is not paused");
|
||||
|
||||
await navigate(dbg, "doc-scripts.html", ...sources);
|
||||
is(countSources(dbg), 5, "5 sources are loaded.");
|
||||
|
@ -51,8 +51,5 @@ add_task(async function() {
|
|||
await reload(dbg, "long.js");
|
||||
await waitForSelectedSource(dbg, "long.js");
|
||||
|
||||
ok(
|
||||
getSelectedSource(getState()).url.includes("long.js"),
|
||||
"Selected source is long.js"
|
||||
);
|
||||
ok(getSelectedSource().url.includes("long.js"), "Selected source is long.js");
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Tests that when pause on next is selected, we pause on the next execution
|
||||
|
||||
|
@ -10,7 +11,7 @@ add_task(async function() {
|
|||
} = dbg;
|
||||
|
||||
clickElement(dbg, "pause");
|
||||
await waitForState(dbg, state => getIsWaitingOnBreak(state, getCurrentThread(state)));
|
||||
await waitForState(dbg, state => getIsWaitingOnBreak(getCurrentThread()));
|
||||
invokeInTab("simple");
|
||||
|
||||
await waitForPaused(dbg, "simple3");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
requestLongerTimeout(2);
|
||||
|
||||
|
@ -7,23 +8,23 @@ async function stepOvers(dbg, count, onStep = () => {}) {
|
|||
for (let i = 0; i < count; i++) {
|
||||
await dbg.actions.stepOver(getThreadContext(dbg));
|
||||
await waitForPaused(dbg);
|
||||
onStep(dbg.getState());
|
||||
onStep();
|
||||
}
|
||||
}
|
||||
function formatSteps(steps) {
|
||||
return steps.map(loc => `(${loc.join(",")})`).join(", ")
|
||||
return steps.map(loc => `(${loc.join(",")})`).join(", ");
|
||||
}
|
||||
|
||||
async function testCase(dbg, { name, steps }) {
|
||||
invokeInTab(name);
|
||||
let locations = [];
|
||||
const locations = [];
|
||||
|
||||
const {
|
||||
selectors: { getTopFrame, getCurrentThread }
|
||||
} = dbg;
|
||||
|
||||
await stepOvers(dbg, steps.length, state => {
|
||||
const {line, column} = getTopFrame(state, getCurrentThread(state)).location
|
||||
const { line, column } = getTopFrame(getCurrentThread()).location;
|
||||
locations.push([line, column]);
|
||||
});
|
||||
|
||||
|
@ -34,20 +35,29 @@ async function testCase(dbg, { name, steps }) {
|
|||
add_task(async function test() {
|
||||
const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
|
||||
|
||||
await selectSource(dbg, "pause-points.js")
|
||||
await selectSource(dbg, "pause-points.js");
|
||||
await testCase(dbg, {
|
||||
name: "statements",
|
||||
steps: [[9,2], [10,4], [10,13], [11,2], [11,21], [12,2], [12,12], [13,0]]
|
||||
steps: [
|
||||
[9, 2],
|
||||
[10, 4],
|
||||
[10, 13],
|
||||
[11, 2],
|
||||
[11, 21],
|
||||
[12, 2],
|
||||
[12, 12],
|
||||
[13, 0]
|
||||
]
|
||||
});
|
||||
|
||||
await testCase(dbg, {
|
||||
name: "expressions",
|
||||
steps: [[40,2], [41,2], [42,12], [43,0]]
|
||||
steps: [[40, 2], [41, 2], [42, 12], [43, 0]]
|
||||
});
|
||||
|
||||
await testCase(dbg, {
|
||||
name: "sequences",
|
||||
steps: [[23,2], [25,12], [29,12], [34,2], [37,0]]
|
||||
steps: [[23, 2], [25, 12], [29, 12], [34, 2], [37, 0]]
|
||||
});
|
||||
|
||||
await testCase(dbg, {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
function getScrollTop(dbg) {
|
||||
return getCM(dbg).doc.scrollTop;
|
||||
|
@ -9,7 +10,7 @@ async function waitForMatch(dbg, { matchIndex, count }) {
|
|||
await waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
const result = dbg.selectors.getFileSearchResults(state);
|
||||
const result = dbg.selectors.getFileSearchResults();
|
||||
return result.matchIndex == matchIndex && result.count == count;
|
||||
},
|
||||
"wait for match"
|
||||
|
@ -21,20 +22,20 @@ add_task(async function() {
|
|||
|
||||
// Make sure that we can set a breakpoint on a line out of the
|
||||
// viewport, and that pausing there scrolls the editor to it.
|
||||
let longSrc = findSource(dbg, "long.js");
|
||||
await selectSource(dbg, "long.js")
|
||||
const longSrc = findSource(dbg, "long.js");
|
||||
await selectSource(dbg, "long.js");
|
||||
await addBreakpoint(dbg, longSrc, 66);
|
||||
invokeInTab("testModel");
|
||||
await waitForPaused(dbg, "long.js");
|
||||
|
||||
const pauseScrollTop = getScrollTop(dbg);
|
||||
|
||||
log("1. adding a breakpoint should not scroll the editor");
|
||||
info("1. adding a breakpoint should not scroll the editor");
|
||||
getCM(dbg).scrollTo(0, 0);
|
||||
await addBreakpoint(dbg, longSrc, 11);
|
||||
is(getScrollTop(dbg), 0, "scroll position");
|
||||
|
||||
log("2. searching should jump to the match");
|
||||
info("2. searching should jump to the match");
|
||||
pressKey(dbg, "fileSearch");
|
||||
type(dbg, "check");
|
||||
await waitForMatch(dbg, { matchIndex: 0, count: 2 });
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-minified.html", "math.min.js");
|
||||
const thread = dbg.selectors.getCurrentThread(dbg.getState());
|
||||
const thread = dbg.selectors.getCurrentThread();
|
||||
|
||||
await selectSource(dbg, "math.min.js");
|
||||
await addBreakpoint(dbg, "math.min.js", 2);
|
||||
|
@ -19,7 +19,7 @@ add_task(async function() {
|
|||
await waitForSelectedSource(dbg, "math.min.js:formatted");
|
||||
await waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getSelectedFrame(state, thread).location.line == 18
|
||||
state => dbg.selectors.getSelectedFrame(thread).location.line == 18
|
||||
);
|
||||
assertPausedLocation(dbg);
|
||||
await assertEditorBreakpoint(dbg, 18, true);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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 assertNoTooltip(dbg) {
|
||||
await waitForTime(200);
|
||||
|
@ -11,7 +12,7 @@ function assertPreviewTooltip(dbg, { result, expression }) {
|
|||
const previewEl = findElement(dbg, "tooltip");
|
||||
is(previewEl.innerText, result, "Preview text shown to user");
|
||||
|
||||
const preview = dbg.selectors.getPreview(dbg.getState());
|
||||
const preview = dbg.selectors.getPreview();
|
||||
is(`${preview.result}`, result, "Preview.result");
|
||||
is(preview.updating, false, "Preview.updating");
|
||||
is(preview.expression, expression, "Preview.expression");
|
||||
|
@ -21,7 +22,7 @@ function assertPreviewPopup(dbg, { field, value, expression }) {
|
|||
const previewEl = findElement(dbg, "popup");
|
||||
is(previewEl.innerText, "", "Preview text shown to user");
|
||||
|
||||
const preview = dbg.selectors.getPreview(dbg.getState());
|
||||
const preview = dbg.selectors.getPreview();
|
||||
|
||||
is(
|
||||
`${preview.result.preview.ownProperties[field].value}`,
|
||||
|
@ -33,7 +34,13 @@ function assertPreviewPopup(dbg, { field, value, expression }) {
|
|||
}
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-sourcemaps.html", "entry.js", "output.js", "times2.js", "opts.js");
|
||||
const dbg = await initDebugger(
|
||||
"doc-sourcemaps.html",
|
||||
"entry.js",
|
||||
"output.js",
|
||||
"times2.js",
|
||||
"opts.js"
|
||||
);
|
||||
const {
|
||||
selectors: { getSelectedSource },
|
||||
getState
|
||||
|
@ -46,19 +53,19 @@ add_task(async function() {
|
|||
await waitForPaused(dbg);
|
||||
await waitForSelectedSource(dbg, "times2");
|
||||
|
||||
info(`Test previewing in the original location`);
|
||||
info("Test previewing in the original location");
|
||||
await assertPreviews(dbg, [
|
||||
{ line: 2, column: 10, result: 4, expression: "x" }
|
||||
]);
|
||||
|
||||
info(`Test previewing in the generated location`);
|
||||
info("Test previewing in the generated location");
|
||||
await dbg.actions.jumpToMappedSelectedLocation(getContext(dbg));
|
||||
await waitForSelectedSource(dbg, "bundle.js");
|
||||
await assertPreviews(dbg, [
|
||||
{ line: 70, column: 11, result: 4, expression: "x" }
|
||||
]);
|
||||
|
||||
info(`Test that you can not preview in another original file`);
|
||||
info("Test that you can not preview in another original file");
|
||||
await selectSource(dbg, "output");
|
||||
await hoverAtPos(dbg, { line: 2, ch: 16 });
|
||||
await assertNoTooltip(dbg);
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
function assertEnabled(dbg) {
|
||||
is(
|
||||
dbg.selectors.getQuickOpenEnabled(dbg.getState()),
|
||||
true,
|
||||
"quickOpen enabled"
|
||||
);
|
||||
is(dbg.selectors.getQuickOpenEnabled(), true, "quickOpen enabled");
|
||||
}
|
||||
|
||||
function assertDisabled(dbg) {
|
||||
is(
|
||||
dbg.selectors.getQuickOpenEnabled(dbg.getState()),
|
||||
false,
|
||||
"quickOpen disabled"
|
||||
);
|
||||
is(dbg.selectors.getQuickOpenEnabled(), false, "quickOpen disabled");
|
||||
}
|
||||
|
||||
function assertLine(dbg, lineNumber) {
|
||||
is(
|
||||
dbg.selectors.getSelectedLocation(dbg.getState()).line,
|
||||
dbg.selectors.getSelectedLocation().line,
|
||||
lineNumber,
|
||||
`goto line is ${lineNumber}`
|
||||
);
|
||||
|
@ -27,7 +20,7 @@ function assertLine(dbg, lineNumber) {
|
|||
|
||||
function assertColumn(dbg, columnNumber) {
|
||||
is(
|
||||
dbg.selectors.getSelectedLocation(dbg.getState()).column,
|
||||
dbg.selectors.getSelectedLocation().column,
|
||||
columnNumber,
|
||||
`goto column is ${columnNumber}`
|
||||
);
|
||||
|
@ -59,7 +52,10 @@ function findResultEl(dbg, index = 1) {
|
|||
|
||||
async function assertResultIsTab(dbg, index) {
|
||||
const el = await findResultEl(dbg, index);
|
||||
ok(el && !!el.querySelector('.tab.result-item-icon'), 'Result should be a tab');
|
||||
ok(
|
||||
el && !!el.querySelector(".tab.result-item-icon"),
|
||||
"Result should be a tab"
|
||||
);
|
||||
}
|
||||
|
||||
// Testing quick open
|
||||
|
@ -88,7 +84,9 @@ add_task(async function() {
|
|||
await assertResultIsTab(dbg, 1);
|
||||
pressKey(dbg, "Tab");
|
||||
|
||||
info("Testing arrow keys in source search and check to see if source is selected");
|
||||
info(
|
||||
"Testing arrow keys in source search and check to see if source is selected"
|
||||
);
|
||||
quickOpen(dbg, "sw2");
|
||||
is(resultCount(dbg), 1, "one file results");
|
||||
pressKey(dbg, "Down");
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
/* 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/>. */
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-react.html", "App.js");
|
||||
|
||||
await selectSource(dbg, "App.js");
|
||||
await addBreakpoint(dbg, "App.js", 11);
|
||||
|
||||
info('Test previewing an immutable Map inside of a react component')
|
||||
info("Test previewing an immutable Map inside of a react component");
|
||||
invokeInTab("clickButton");
|
||||
await waitForPaused(dbg);
|
||||
|
||||
|
@ -12,9 +16,8 @@ add_task(async function() {
|
|||
selectors: { getSelectedScopeMappings, getCurrentThread }
|
||||
} = dbg;
|
||||
|
||||
await waitForState(
|
||||
dbg,
|
||||
state => getSelectedScopeMappings(state, getCurrentThread(state))
|
||||
await waitForState(dbg, state =>
|
||||
getSelectedScopeMappings(getCurrentThread())
|
||||
);
|
||||
|
||||
await assertPreviewTextValue(dbg, 10, 22, {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
/*
|
||||
* Test reloading:
|
||||
|
@ -11,7 +12,7 @@ async function waitForBreakpoint(dbg, location) {
|
|||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
return dbg.selectors.getBreakpoint(dbg.getState(), location);
|
||||
return dbg.selectors.getBreakpoint(location);
|
||||
},
|
||||
"Waiting for breakpoint"
|
||||
);
|
||||
|
@ -32,7 +33,7 @@ add_task(async function() {
|
|||
|
||||
await waitForBreakpoint(dbg, location);
|
||||
|
||||
const breakpointList = dbg.selectors.getBreakpointsList(dbg.getState());
|
||||
const breakpointList = dbg.selectors.getBreakpointsList();
|
||||
const breakpoint = breakpointList[0];
|
||||
|
||||
is(breakpointList.length, 1);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
/*
|
||||
* Test reloading:
|
||||
|
@ -11,31 +12,35 @@ async function waitForBreakpoint(dbg, location) {
|
|||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
return dbg.selectors.getBreakpoint(dbg.getState(), location);
|
||||
return dbg.selectors.getBreakpoint(location);
|
||||
},
|
||||
"Waiting for breakpoint"
|
||||
);
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("ember/quickstart/dist/", "ember-application/index.js");
|
||||
const dbg = await initDebugger(
|
||||
"ember/quickstart/dist/",
|
||||
"ember-application/index.js"
|
||||
);
|
||||
|
||||
await selectSource(dbg, "ember-application/index.js");
|
||||
|
||||
info("1. reload and hit breakpoint")
|
||||
info("1. reload and hit breakpoint");
|
||||
await addBreakpoint(dbg, "ember-application/index.js", 4);
|
||||
reload(dbg, "ember/quickstart/dist/");
|
||||
|
||||
info("2. Wait for sources to appear and then reload")
|
||||
await waitForDispatch(dbg, "ADD_SOURCES")
|
||||
reload(dbg, "ember/quickstart/dist/");
|
||||
|
||||
|
||||
info("3. Wait for sources to appear and then reload mid source-maps")
|
||||
info("2. Wait for sources to appear and then reload");
|
||||
await waitForDispatch(dbg, "ADD_SOURCES");
|
||||
reload(dbg, "ember/quickstart/dist/");
|
||||
|
||||
info("4. wait for the debugger to pause and show that we're in the correct location")
|
||||
await waitForPaused(dbg)
|
||||
info("3. Wait for sources to appear and then reload mid source-maps");
|
||||
await waitForDispatch(dbg, "ADD_SOURCES");
|
||||
reload(dbg, "ember/quickstart/dist/");
|
||||
|
||||
info(
|
||||
"4. wait for the debugger to pause and show that we're in the correct location"
|
||||
);
|
||||
await waitForPaused(dbg);
|
||||
assertPausedLocation(dbg, "ember-application/index.js", 4);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Tests the search bar correctly responds to queries, enter, shift enter
|
||||
|
||||
|
@ -8,7 +9,7 @@ function waitForSearchState(dbg) {
|
|||
}
|
||||
|
||||
function getFocusedEl(dbg) {
|
||||
let doc = dbg.win.document;
|
||||
const doc = dbg.win.document;
|
||||
return doc.activeElement;
|
||||
}
|
||||
|
||||
|
@ -24,11 +25,11 @@ add_task(async function() {
|
|||
|
||||
const cm = getCM(dbg);
|
||||
pressKey(dbg, "fileSearch");
|
||||
is(dbg.selectors.getActiveSearch(dbg.getState()), "file");
|
||||
is(dbg.selectors.getActiveSearch(), "file");
|
||||
|
||||
// test closing and re-opening
|
||||
pressKey(dbg, "Escape");
|
||||
is(dbg.selectors.getActiveSearch(dbg.getState()), null);
|
||||
is(dbg.selectors.getActiveSearch(), null);
|
||||
|
||||
pressKey(dbg, "fileSearch");
|
||||
|
||||
|
|
|
@ -6,20 +6,17 @@ function openProjectSearch(dbg) {
|
|||
synthesizeKeyShortcut("CmdOrCtrl+Shift+F");
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getActiveSearch(state) === "project"
|
||||
state => dbg.selectors.getActiveSearch() === "project"
|
||||
);
|
||||
}
|
||||
|
||||
function closeProjectSearch(dbg) {
|
||||
pressKey(dbg, "Escape");
|
||||
return waitForState(dbg, state => !dbg.selectors.getActiveSearch(state));
|
||||
return waitForState(dbg, state => !dbg.selectors.getActiveSearch());
|
||||
}
|
||||
|
||||
async function selectResult(dbg) {
|
||||
const select = waitForState(
|
||||
dbg,
|
||||
() => !dbg.selectors.getActiveSearch(dbg.getState())
|
||||
);
|
||||
const select = waitForState(dbg, () => !dbg.selectors.getActiveSearch());
|
||||
await clickElement(dbg, "fileMatch");
|
||||
return select;
|
||||
}
|
||||
|
@ -30,7 +27,7 @@ function getExpandedResultsCount(dbg) {
|
|||
|
||||
function getResultsFiles(dbg) {
|
||||
const matches = dbg.selectors
|
||||
.getTextSearchResults(dbg.getState())
|
||||
.getTextSearchResults()
|
||||
.map(file => file.matches);
|
||||
|
||||
return [...matches].length;
|
||||
|
@ -54,9 +51,9 @@ add_task(async function() {
|
|||
|
||||
await selectResult(dbg);
|
||||
|
||||
is(dbg.selectors.getActiveSearch(dbg.getState()), null);
|
||||
is(dbg.selectors.getActiveSearch(), null);
|
||||
|
||||
const selectedSource = dbg.selectors.getSelectedSource(dbg.getState());
|
||||
const selectedSource = dbg.selectors.getSelectedSource();
|
||||
ok(selectedSource.url.includes("switching-01"));
|
||||
await waitForLoadedSource(dbg, "switching-01");
|
||||
});
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Tests for stepping through Babel's compile output.
|
||||
requestLongerTimeout(4);
|
||||
|
||||
async function breakpointSteps(dbg, target, fixture, { line, column }, steps) {
|
||||
const filename = `${target}://./${fixture}/input.`;
|
||||
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) => c.toUpperCase());
|
||||
const fnName = `${target}-${fixture}`.replace(/-([a-z])/g, (s, c) =>
|
||||
c.toUpperCase()
|
||||
);
|
||||
|
||||
await invokeWithBreakpoint(
|
||||
dbg,
|
||||
|
@ -39,7 +42,7 @@ async function runSteps(dbg, source, steps) {
|
|||
throw new Error("Unknown stepping type");
|
||||
}
|
||||
|
||||
const { location } = getVisibleSelectedFrame(getState());
|
||||
const { location } = getVisibleSelectedFrame();
|
||||
|
||||
is(location.sourceId, source.id, `Step ${i} has correct sourceId`);
|
||||
is(location.line, position.line, `Step ${i} has correct line`);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Test that an error while loading a sourcemap does not break
|
||||
// debugging.
|
||||
|
@ -20,5 +21,5 @@ add_task(async function() {
|
|||
|
||||
// Make sure that only the single generated source exists. The
|
||||
// sourcemap failed to download.
|
||||
is(dbg.selectors.getSourceCount(dbg.getState()), 1, "Only 1 source exists");
|
||||
is(dbg.selectors.getSourceCount(), 1, "Only 1 source exists");
|
||||
});
|
||||
|
|
|
@ -12,18 +12,18 @@ async function waitForBreakpoint(dbg, location) {
|
|||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
return dbg.selectors.getBreakpoint(dbg.getState(), location);
|
||||
return dbg.selectors.getBreakpoint(location);
|
||||
},
|
||||
"Waiting for breakpoint"
|
||||
);
|
||||
}
|
||||
|
||||
function getBreakpoints(dbg) {
|
||||
return dbg.selectors.getBreakpointsList(dbg.getState());
|
||||
return dbg.selectors.getBreakpointsList();
|
||||
}
|
||||
|
||||
function getBreakpointCount(dbg) {
|
||||
return dbg.selectors.getBreakpointCount(dbg.getState());
|
||||
return dbg.selectors.getBreakpointCount();
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
|
@ -39,7 +39,7 @@ add_task(async function() {
|
|||
is(breakpoint.location.line, 6);
|
||||
|
||||
info("Reload with a new version of the file");
|
||||
let syncBp = waitForDispatch(dbg, "SET_BREAKPOINT");
|
||||
const syncBp = waitForDispatch(dbg, "SET_BREAKPOINT");
|
||||
await navigate(dbg, "doc-sourcemaps-reload2.html", "v1.js");
|
||||
|
||||
await syncBp;
|
||||
|
|
|
@ -6,7 +6,7 @@ requestLongerTimeout(2);
|
|||
async function waitForBreakpointCount(dbg, count) {
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getBreakpointCount(state) === count
|
||||
state => dbg.selectors.getBreakpointCount() === count
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,7 @@ add_task(async function() {
|
|||
// NOTE: the CORS call makes the test run times inconsistent
|
||||
const dbg = await initDebugger("doc-sourcemaps.html");
|
||||
const {
|
||||
selectors: { getBreakpoint, getBreakpointCount },
|
||||
getState
|
||||
selectors: { getBreakpoint, getBreakpointCount }
|
||||
} = dbg;
|
||||
|
||||
await waitForSources(dbg, "entry.js", "output.js", "times2.js", "opts.js");
|
||||
|
@ -42,15 +41,15 @@ add_task(async function() {
|
|||
assertPausedLocation(dbg);
|
||||
|
||||
await waitForBreakpointCount(dbg, 2);
|
||||
is(getBreakpointCount(getState()), 2, "Three breakpoints exist");
|
||||
is(getBreakpointCount(), 2, "Three breakpoints exist");
|
||||
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15, column: 0 }),
|
||||
getBreakpoint({ sourceId: entrySrc.id, line: 15, column: 0 }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
|
||||
ok(
|
||||
getBreakpoint(getState(), {
|
||||
getBreakpoint({
|
||||
sourceId: entrySrc.id,
|
||||
line: 15,
|
||||
column: 0,
|
||||
|
|
|
@ -13,7 +13,7 @@ function assertBreakpointExists(dbg, source, line) {
|
|||
} = dbg;
|
||||
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: source.id, line }),
|
||||
getBreakpoint({ sourceId: source.id, line }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ async function waitForBreakpointCount(dbg, count) {
|
|||
selectors: { getBreakpointCount },
|
||||
getState
|
||||
} = dbg;
|
||||
await waitForState(dbg, state => getBreakpointCount(getState()) == count);
|
||||
await waitForState(dbg, state => getBreakpointCount() == count);
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
|
@ -77,7 +77,7 @@ add_task(async function() {
|
|||
|
||||
await clickGutter(dbg, 70);
|
||||
await waitForBreakpointCount(dbg, 0);
|
||||
is(dbg.selectors.getBreakpointCount(getState()), 0, "No breakpoints exists");
|
||||
is(dbg.selectors.getBreakpointCount(), 0, "No breakpoints exists");
|
||||
|
||||
const entrySrc = findSource(dbg, "entry.js");
|
||||
|
||||
|
@ -91,7 +91,7 @@ add_task(async function() {
|
|||
|
||||
// Test breaking on a breakpoint
|
||||
await addBreakpoint(dbg, "entry.js", 15);
|
||||
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
|
||||
is(getBreakpointCount(), 1, "One breakpoint exists");
|
||||
assertBreakpointExists(dbg, entrySrc, 15);
|
||||
|
||||
invokeInTab("keepMeAlive");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
requestLongerTimeout(2);
|
||||
|
||||
function assertBpInGutter(dbg, lineNumber) {
|
||||
|
@ -18,7 +19,11 @@ function assertBpInGutter(dbg, lineNumber) {
|
|||
// This source map does not have source contents, so it's fetched separately
|
||||
add_task(async function() {
|
||||
// NOTE: the CORS call makes the test run times inconsistent
|
||||
const dbg = await initDebugger("doc-sourcemaps2.html", "main.js", "main.min.js");
|
||||
const dbg = await initDebugger(
|
||||
"doc-sourcemaps2.html",
|
||||
"main.js",
|
||||
"main.min.js"
|
||||
);
|
||||
const {
|
||||
selectors: { getBreakpoint, getBreakpointCount },
|
||||
getState
|
||||
|
@ -31,9 +36,9 @@ add_task(async function() {
|
|||
|
||||
// Test that breakpoint is not off by a line.
|
||||
await addBreakpoint(dbg, mainSrc, 4, 2);
|
||||
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
|
||||
is(getBreakpointCount(), 1, "One breakpoint exists");
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: mainSrc.id, line: 4, column: 2 }),
|
||||
getBreakpoint({ sourceId: mainSrc.id, line: 4, column: 2 }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
// Tests loading sourcemapped sources, setting breakpoints, and
|
||||
// inspecting restored scopes.
|
||||
|
@ -10,7 +11,12 @@ add_task(async function() {
|
|||
// NOTE: the CORS call makes the test run times inconsistent
|
||||
await pushPref("devtools.debugger.features.map-scopes", true);
|
||||
|
||||
const dbg = await initDebugger("doc-sourcemaps3.html", "bundle.js", "sorted.js", "test.js");
|
||||
const dbg = await initDebugger(
|
||||
"doc-sourcemaps3.html",
|
||||
"bundle.js",
|
||||
"sorted.js",
|
||||
"test.js"
|
||||
);
|
||||
const {
|
||||
selectors: { getBreakpoint, getBreakpointCount },
|
||||
getState
|
||||
|
@ -23,9 +29,9 @@ add_task(async function() {
|
|||
|
||||
// Test that breakpoint is not off by a line.
|
||||
await addBreakpoint(dbg, sortedSrc, 9, 4);
|
||||
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
|
||||
is(getBreakpointCount(), 1, "One breakpoint exists");
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: sortedSrc.id, line: 9, column: 4 }),
|
||||
getBreakpoint({ sourceId: sortedSrc.id, line: 9, column: 4 }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
// Tests that the source tree works.
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-sources.html", "simple1", "simple2", "nested-source", "long.js");
|
||||
const dbg = await initDebugger(
|
||||
"doc-sources.html",
|
||||
"simple1",
|
||||
"simple2",
|
||||
"nested-source",
|
||||
"long.js"
|
||||
);
|
||||
const {
|
||||
selectors: { getSelectedSource },
|
||||
getState
|
||||
|
@ -29,7 +35,7 @@ add_task(async function() {
|
|||
|
||||
const focusedNode = findElementWithSelector(dbg, ".sources-list .focused");
|
||||
const fourthNode = findElement(dbg, "sourceNode", 4);
|
||||
const selectedSource = getSelectedSource(getState()).url;
|
||||
const selectedSource = getSelectedSource().url;
|
||||
|
||||
ok(fourthNode.classList.contains("focused"), "4th node is focused");
|
||||
ok(selectedSource.includes("nested-source.js"), "nested-source is selected");
|
||||
|
|
|
@ -121,7 +121,7 @@ function waitForThreadEvents(dbg, eventName) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Waits for `predicate(state)` to be true. `state` is the redux app state.
|
||||
* Waits for `predicate()` to be true. `state` is the redux app state.
|
||||
*
|
||||
* @memberof mochitest/waits
|
||||
* @param {Object} dbg
|
||||
|
@ -224,7 +224,7 @@ function assertClass(el, className, exists = true) {
|
|||
|
||||
function waitForSelectedLocation(dbg, line) {
|
||||
return waitForState(dbg, state => {
|
||||
const location = dbg.selectors.getSelectedLocation(state);
|
||||
const location = dbg.selectors.getSelectedLocation();
|
||||
return location && location.line == line;
|
||||
});
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ function waitForSelectedSource(dbg, url) {
|
|||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
const source = getSelectedSource(state);
|
||||
const source = getSelectedSource();
|
||||
const isLoaded = source && sourceUtils.isLoaded(source);
|
||||
if (!isLoaded) {
|
||||
return false;
|
||||
|
@ -254,9 +254,7 @@ function waitForSelectedSource(dbg, url) {
|
|||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
hasSymbols(state, source) && hasBreakpointPositions(state, source.id)
|
||||
);
|
||||
return hasSymbols(source) && hasBreakpointPositions(source.id);
|
||||
},
|
||||
"selected source"
|
||||
);
|
||||
|
@ -289,20 +287,16 @@ function assertEmptyLines(dbg, lines) {
|
|||
return every(subArray, subItem => superArray.includes(subItem));
|
||||
}
|
||||
|
||||
const sourceId = dbg.selectors.getSelectedSourceId(dbg.store.getState());
|
||||
const emptyLines = dbg.selectors.getEmptyLines(
|
||||
dbg.store.getState(),
|
||||
sourceId
|
||||
);
|
||||
const sourceId = dbg.selectors.getSelectedSourceId();
|
||||
const emptyLines = dbg.selectors.getEmptyLines(sourceId);
|
||||
ok(subset(lines, emptyLines), "empty lines should match");
|
||||
}
|
||||
|
||||
function getVisibleSelectedFrameLine(dbg) {
|
||||
const {
|
||||
selectors: { getVisibleSelectedFrame },
|
||||
getState
|
||||
selectors: { getVisibleSelectedFrame }
|
||||
} = dbg;
|
||||
const frame = getVisibleSelectedFrame(getState());
|
||||
const frame = getVisibleSelectedFrame();
|
||||
return frame && frame.location.line;
|
||||
}
|
||||
|
||||
|
@ -321,10 +315,7 @@ function assertPausedLocation(dbg) {
|
|||
getState
|
||||
} = dbg;
|
||||
|
||||
ok(
|
||||
isSelectedFrameSelected(dbg, getState()),
|
||||
"top frame's source is selected"
|
||||
);
|
||||
ok(isSelectedFrameSelected(dbg), "top frame's source is selected");
|
||||
|
||||
// Check the pause location
|
||||
const pauseLine = getVisibleSelectedFrameLine(dbg);
|
||||
|
@ -336,7 +327,7 @@ function assertPausedLocation(dbg) {
|
|||
function assertDebugLine(dbg, line) {
|
||||
// Check the debug line
|
||||
const lineInfo = getCM(dbg).lineInfo(line - 1);
|
||||
const source = dbg.selectors.getSelectedSource(dbg.getState());
|
||||
const source = dbg.selectors.getSelectedSource();
|
||||
if (source && source.loadedState == "loading") {
|
||||
const url = source.url;
|
||||
ok(
|
||||
|
@ -399,7 +390,7 @@ function assertHighlightLocation(dbg, source, line) {
|
|||
source = findSource(dbg, source);
|
||||
|
||||
// Check the selected source
|
||||
is(getSelectedSource(getState()).url, source.url, "source url is correct");
|
||||
is(getSelectedSource().url, source.url, "source url is correct");
|
||||
|
||||
// Check the highlight line
|
||||
const lineEl = findElement(dbg, "highlightLine");
|
||||
|
@ -430,7 +421,7 @@ function isPaused(dbg) {
|
|||
selectors: { getIsPaused, getCurrentThread },
|
||||
getState
|
||||
} = dbg;
|
||||
return getIsPaused(getState(), getCurrentThread(getState()));
|
||||
return getIsPaused(getCurrentThread());
|
||||
}
|
||||
|
||||
// Make sure the debugger is paused at a certain source ID and line.
|
||||
|
@ -442,7 +433,7 @@ function assertPausedAtSourceAndLine(dbg, expectedSourceId, expectedLine) {
|
|||
getState
|
||||
} = dbg;
|
||||
|
||||
const frames = getCurrentThreadFrames(getState());
|
||||
const frames = getCurrentThreadFrames();
|
||||
ok(frames.length >= 1, "Got at least one frame");
|
||||
const { sourceId, line } = frames[0].location;
|
||||
ok(sourceId == expectedSourceId, "Frame has correct source");
|
||||
|
@ -452,13 +443,7 @@ function assertPausedAtSourceAndLine(dbg, expectedSourceId, expectedLine) {
|
|||
// Get any workers associated with the debugger.
|
||||
async function getWorkers(dbg) {
|
||||
await dbg.actions.updateWorkers();
|
||||
|
||||
const {
|
||||
selectors: { getWorkers },
|
||||
getState
|
||||
} = dbg;
|
||||
|
||||
return getWorkers(getState());
|
||||
return dbg.selectors.getWorkers();
|
||||
}
|
||||
|
||||
async function waitForLoadedScopes(dbg) {
|
||||
|
@ -471,7 +456,7 @@ async function waitForLoadedScopes(dbg) {
|
|||
function waitForBreakpointCount(dbg, count) {
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getBreakpointCount(state) == count
|
||||
state => dbg.selectors.getBreakpointCount() == count
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -491,8 +476,7 @@ async function waitForPaused(dbg, url) {
|
|||
|
||||
await waitForState(
|
||||
dbg,
|
||||
state =>
|
||||
isPaused(dbg) && !!getSelectedScope(state, getCurrentThread(state)),
|
||||
state => isPaused(dbg) && !!getSelectedScope(getCurrentThread()),
|
||||
"paused"
|
||||
);
|
||||
|
||||
|
@ -503,7 +487,7 @@ async function waitForPaused(dbg, url) {
|
|||
function waitForCondition(dbg, condition) {
|
||||
return waitForState(dbg, state =>
|
||||
dbg.selectors
|
||||
.getBreakpointsList(state)
|
||||
.getBreakpointsList()
|
||||
.find(bp => bp.options.condition == condition)
|
||||
);
|
||||
}
|
||||
|
@ -511,13 +495,13 @@ function waitForCondition(dbg, condition) {
|
|||
function waitForLog(dbg, logValue) {
|
||||
return waitForState(dbg, state =>
|
||||
dbg.selectors
|
||||
.getBreakpointsList(state)
|
||||
.getBreakpointsList()
|
||||
.find(bp => bp.options.logValue == logValue)
|
||||
);
|
||||
}
|
||||
|
||||
async function waitForPausedThread(dbg, thread) {
|
||||
return waitForState(dbg, state => dbg.selectors.getIsPaused(state, thread));
|
||||
return waitForState(dbg, state => dbg.selectors.getIsPaused(thread));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -539,12 +523,12 @@ function waitForTime(ms) {
|
|||
}
|
||||
|
||||
function isSelectedFrameSelected(dbg, state) {
|
||||
const frame = dbg.selectors.getVisibleSelectedFrame(state);
|
||||
const frame = dbg.selectors.getVisibleSelectedFrame();
|
||||
|
||||
// Make sure the source text is completely loaded for the
|
||||
// source we are paused in.
|
||||
const sourceId = frame.location.sourceId;
|
||||
const source = dbg.selectors.getSelectedSource(state);
|
||||
const source = dbg.selectors.getSelectedSource();
|
||||
|
||||
if (!source) {
|
||||
return false;
|
||||
|
@ -633,7 +617,7 @@ function findSource(dbg, url, { silent } = { silent: false }) {
|
|||
return source;
|
||||
}
|
||||
|
||||
const sources = Object.values(dbg.selectors.getSources(dbg.getState()));
|
||||
const sources = Object.values(dbg.selectors.getSources());
|
||||
const source = sources.find(s => (s.url || "").includes(url));
|
||||
|
||||
if (!source) {
|
||||
|
@ -663,7 +647,7 @@ function waitForLoadedSources(dbg) {
|
|||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
const sources = Object.values(dbg.selectors.getSources(state));
|
||||
const sources = Object.values(dbg.selectors.getSources());
|
||||
return !sources.some(source => source.loadedState == "loading");
|
||||
},
|
||||
"loaded source"
|
||||
|
@ -671,11 +655,11 @@ function waitForLoadedSources(dbg) {
|
|||
}
|
||||
|
||||
function getContext(dbg) {
|
||||
return dbg.selectors.getContext(dbg.getState());
|
||||
return dbg.selectors.getContext();
|
||||
}
|
||||
|
||||
function getThreadContext(dbg) {
|
||||
return dbg.selectors.getThreadContext(dbg.getState());
|
||||
return dbg.selectors.getThreadContext();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -806,8 +790,8 @@ async function navigate(dbg, url, ...sources) {
|
|||
|
||||
function getFirstBreakpointColumn(dbg, { line, sourceId }) {
|
||||
const { getSource, getFirstBreakpointPosition } = dbg.selectors;
|
||||
const source = getSource(dbg.getState(), sourceId);
|
||||
const position = getFirstBreakpointPosition(dbg.getState(), {
|
||||
const source = getSource(sourceId);
|
||||
const position = getFirstBreakpointPosition({
|
||||
line,
|
||||
sourceId
|
||||
});
|
||||
|
@ -829,14 +813,14 @@ function getFirstBreakpointColumn(dbg, { line, sourceId }) {
|
|||
async function addBreakpoint(dbg, source, line, column, options) {
|
||||
source = findSource(dbg, source);
|
||||
const sourceId = source.id;
|
||||
const bpCount = dbg.selectors.getBreakpointCount(dbg.getState());
|
||||
const bpCount = dbg.selectors.getBreakpointCount();
|
||||
await dbg.actions.addBreakpoint(
|
||||
getContext(dbg),
|
||||
{ sourceId, line, column },
|
||||
options
|
||||
);
|
||||
is(
|
||||
dbg.selectors.getBreakpointCount(dbg.getState()),
|
||||
dbg.selectors.getBreakpointCount(),
|
||||
bpCount + 1,
|
||||
"a new breakpoint was created"
|
||||
);
|
||||
|
@ -846,7 +830,7 @@ function disableBreakpoint(dbg, source, line, column) {
|
|||
column =
|
||||
column || getFirstBreakpointColumn(dbg, { line, sourceId: source.id });
|
||||
const location = { sourceId: source.id, sourceUrl: source.url, line, column };
|
||||
const bp = dbg.selectors.getBreakpointForLocation(dbg.getState(), location);
|
||||
const bp = dbg.selectors.getBreakpointForLocation(location);
|
||||
return dbg.actions.disableBreakpoint(getContext(dbg), bp);
|
||||
}
|
||||
|
||||
|
@ -868,7 +852,7 @@ function findBreakpoint(dbg, url, line) {
|
|||
} = dbg;
|
||||
const source = findSource(dbg, url);
|
||||
const column = getFirstBreakpointColumn(dbg, { line, sourceId: source.id });
|
||||
return getBreakpoint(getState(), { sourceId: source.id, line, column });
|
||||
return getBreakpoint({ sourceId: source.id, line, column });
|
||||
}
|
||||
|
||||
async function loadAndAddBreakpoint(dbg, filename, line, column) {
|
||||
|
@ -887,9 +871,9 @@ async function loadAndAddBreakpoint(dbg, filename, line, column) {
|
|||
// Test that breakpoint is not off by a line.
|
||||
await addBreakpoint(dbg, source, line, column);
|
||||
|
||||
is(getBreakpointCount(getState()), 1, "One breakpoint exists");
|
||||
if (!getBreakpoint(getState(), { sourceId: source.id, line, column })) {
|
||||
const breakpoints = getBreakpointsMap(getState());
|
||||
is(getBreakpointCount(), 1, "One breakpoint exists");
|
||||
if (!getBreakpoint({ sourceId: source.id, line, column })) {
|
||||
const breakpoints = getBreakpointsMap();
|
||||
const id = Object.keys(breakpoints).pop();
|
||||
const loc = breakpoints[id].location;
|
||||
ok(
|
||||
|
@ -932,18 +916,19 @@ async function invokeWithBreakpoint(
|
|||
|
||||
await removeBreakpoint(dbg, source.id, line, column);
|
||||
|
||||
is(getBreakpointCount(getState()), 0, "Breakpoint reverted");
|
||||
is(getBreakpointCount(), 0, "Breakpoint reverted");
|
||||
|
||||
await handler(source);
|
||||
|
||||
await resume(dbg);
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
// If the invoke errored later somehow, capture here so the error is reported nicely.
|
||||
await invokeResult;
|
||||
}
|
||||
|
||||
function prettyPrint(dbg) {
|
||||
const sourceId = dbg.selectors.getSelectedSourceId(dbg.store.getState());
|
||||
const sourceId = dbg.selectors.getSelectedSourceId();
|
||||
return dbg.actions.togglePrettyPrint(getContext(dbg), sourceId);
|
||||
}
|
||||
|
||||
|
@ -992,10 +977,10 @@ async function assertScopes(dbg, items) {
|
|||
* @static
|
||||
*/
|
||||
function removeBreakpoint(dbg, sourceId, line, column) {
|
||||
const source = dbg.selectors.getSource(dbg.getState(), sourceId);
|
||||
const source = dbg.selectors.getSource(sourceId);
|
||||
column = column || getFirstBreakpointColumn(dbg, { line, sourceId });
|
||||
const location = { sourceId, sourceUrl: source.url, line, column };
|
||||
const bp = dbg.selectors.getBreakpointForLocation(dbg.getState(), location);
|
||||
const bp = dbg.selectors.getBreakpointForLocation(location);
|
||||
return dbg.actions.removeBreakpoint(getContext(dbg), bp);
|
||||
}
|
||||
|
||||
|
@ -1024,11 +1009,7 @@ function waitForActive(dbg) {
|
|||
const {
|
||||
selectors: { getIsPaused, getCurrentThread }
|
||||
} = dbg;
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => !getIsPaused(state, getCurrentThread(state)),
|
||||
"active"
|
||||
);
|
||||
return waitForState(dbg, state => !getIsPaused(getCurrentThread()), "active");
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
@ -1050,7 +1031,7 @@ function invokeInTab(fnc, ...args) {
|
|||
fnc,
|
||||
args
|
||||
}) {
|
||||
return content.wrappedJSObject[fnc](...args); // max-len
|
||||
return content.wrappedJSObject[fnc](...args);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1203,6 +1184,7 @@ const selectors = {
|
|||
expressionNode: i =>
|
||||
`.expressions-list .expression-container:nth-child(${i}) .object-label`,
|
||||
expressionValue: i =>
|
||||
// eslint-disable-next-line max-len
|
||||
`.expressions-list .expression-container:nth-child(${i}) .object-delimiter + *`,
|
||||
expressionClose: i =>
|
||||
`.expressions-list .expression-container:nth-child(${i}) .close`,
|
||||
|
@ -1559,7 +1541,7 @@ async function assertPreviewTextValue(dbg, line, column, { text, expression }) {
|
|||
|
||||
ok(previewEl.innerText.includes(text), "Preview text shown to user");
|
||||
|
||||
const preview = dbg.selectors.getPreview(dbg.getState());
|
||||
const preview = dbg.selectors.getPreview();
|
||||
is(preview.updating, false, "Preview.updating");
|
||||
is(preview.expression, expression, "Preview.expression");
|
||||
}
|
||||
|
@ -1569,7 +1551,7 @@ async function assertPreviewTooltip(dbg, line, column, { result, expression }) {
|
|||
|
||||
is(previewEl.innerText, result, "Preview text shown to user");
|
||||
|
||||
const preview = dbg.selectors.getPreview(dbg.getState());
|
||||
const preview = dbg.selectors.getPreview();
|
||||
is(`${preview.result}`, result, "Preview.result");
|
||||
is(preview.updating, false, "Preview.updating");
|
||||
is(preview.expression, expression, "Preview.expression");
|
||||
|
@ -1583,7 +1565,7 @@ async function assertPreviewPopup(
|
|||
) {
|
||||
await tryHovering(dbg, line, column, "popup");
|
||||
|
||||
const preview = dbg.selectors.getPreview(dbg.getState());
|
||||
const preview = dbg.selectors.getPreview();
|
||||
|
||||
const properties =
|
||||
preview.result.preview.ownProperties || preview.result.preview.items;
|
||||
|
@ -1627,7 +1609,7 @@ async function waitForBreakableLine(dbg, source, lineNumber) {
|
|||
const currentSource = findSource(dbg, source);
|
||||
|
||||
const emptyLines =
|
||||
currentSource && dbg.selectors.getEmptyLines(state, currentSource.id);
|
||||
currentSource && dbg.selectors.getEmptyLines(currentSource.id);
|
||||
|
||||
return emptyLines && !emptyLines.includes(lineNumber);
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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/>. */
|
||||
|
||||
/**
|
||||
* Helper method to create a "dbg" context for other tools to use
|
||||
|
@ -8,14 +9,9 @@
|
|||
function createDebuggerContext(toolbox) {
|
||||
const panel = toolbox.getPanel("jsdebugger");
|
||||
const win = panel.panelWin;
|
||||
const { store, client, selectors, actions } = panel.getVarsForTests();
|
||||
|
||||
return {
|
||||
actions: actions,
|
||||
selectors: selectors,
|
||||
getState: store.getState,
|
||||
store: store,
|
||||
client: client,
|
||||
...win.dbg,
|
||||
toolbox: toolbox,
|
||||
win: win,
|
||||
panel: panel
|
||||
|
|
|
@ -45,6 +45,7 @@ support-files =
|
|||
shared-head.js
|
||||
!/devtools/client/shared/test/shared-head.js
|
||||
!/devtools/client/shared/test/telemetry-test-helpers.js
|
||||
!/devtools/client/debugger/test/mochitest/helpers/context.js
|
||||
!/devtools/client/shared/test/test-actor.js
|
||||
!/devtools/client/shared/test/test-actor-registry.js
|
||||
|
||||
|
|
|
@ -6,11 +6,7 @@
|
|||
// Test that the highlighter works when the debugger is paused.
|
||||
|
||||
function debuggerIsPaused(dbg) {
|
||||
const {
|
||||
selectors: { getIsPaused, getCurrentThread },
|
||||
getState,
|
||||
} = dbg;
|
||||
return !!getIsPaused(getState(), getCurrentThread(getState()));
|
||||
return !!dbg.selectors.getIsPaused(dbg.selectors.getCurrentThread());
|
||||
}
|
||||
|
||||
function waitForPaused(dbg) {
|
||||
|
@ -29,22 +25,6 @@ function waitForPaused(dbg) {
|
|||
});
|
||||
}
|
||||
|
||||
async function createDebuggerContext(toolbox) {
|
||||
const panel = await toolbox.getPanelWhenReady("jsdebugger");
|
||||
const win = panel.panelWin;
|
||||
const { store, client, selectors, actions } = panel.getVarsForTests();
|
||||
|
||||
return {
|
||||
actions: actions,
|
||||
selectors: selectors,
|
||||
getState: store.getState,
|
||||
store: store,
|
||||
client: client,
|
||||
toolbox: toolbox,
|
||||
win: win,
|
||||
panel: panel,
|
||||
};
|
||||
}
|
||||
|
||||
const IFRAME_SRC = "<style>" +
|
||||
"body {" +
|
||||
|
|
|
@ -22,6 +22,12 @@ Services.scriptloader.loadSubScript(
|
|||
"chrome://mochitests/content/browser/devtools/client/inspector/test/shared-head.js",
|
||||
this);
|
||||
|
||||
// Import helpers for the new debugger
|
||||
/* import-globals-from ../../debugger/test/mochitest/helpers/context.js */
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/helpers/context.js",
|
||||
this);
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const INSPECTOR_L10N =
|
||||
new LocalizationHelper("devtools/client/locales/inspector.properties");
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
"use strict";
|
||||
/* import-globals-from head.js*/
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
const TEST_URI =
|
||||
"http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/mochitest/test-autocomplete-in-stackframe.html";
|
||||
|
||||
requestLongerTimeout(20);
|
||||
|
@ -26,9 +27,7 @@ add_task(async function() {
|
|||
async function performTests() {
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
const { jsterm } = hud;
|
||||
const {
|
||||
autocompletePopup: popup,
|
||||
} = jsterm;
|
||||
const { autocompletePopup: popup } = jsterm;
|
||||
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const toolbox = gDevTools.getToolbox(target);
|
||||
|
@ -46,19 +45,27 @@ async function performTests() {
|
|||
|
||||
// Test if 'foo' gives 'foo1' but not 'foo2' or 'foo3'
|
||||
await jstermComplete("foo");
|
||||
is(getPopupLabels(popup).join("-"), "foo1-foo1Obj",
|
||||
`"foo" gave the expected suggestions`);
|
||||
is(
|
||||
getPopupLabels(popup).join("-"),
|
||||
"foo1-foo1Obj",
|
||||
`"foo" gave the expected suggestions`
|
||||
);
|
||||
|
||||
// Test if 'foo1Obj.' gives 'prop1' and 'prop2'
|
||||
await jstermComplete("foo1Obj.");
|
||||
checkInputCompletionValue(hud, " prop1", "foo1Obj completion");
|
||||
is(getPopupLabels(popup).join("-"), "prop1-prop2",
|
||||
`"foo1Obj." gave the expected suggestions`);
|
||||
is(
|
||||
getPopupLabels(popup).join("-"),
|
||||
"prop1-prop2",
|
||||
`"foo1Obj." gave the expected suggestions`
|
||||
);
|
||||
|
||||
// Test if 'foo1Obj.prop2.' gives 'prop21'
|
||||
await jstermComplete("foo1Obj.prop2.");
|
||||
ok(getPopupLabels(popup).includes("prop21"),
|
||||
`"foo1Obj.prop2." gave the expected suggestions`);
|
||||
ok(
|
||||
getPopupLabels(popup).includes("prop21"),
|
||||
`"foo1Obj.prop2." gave the expected suggestions`
|
||||
);
|
||||
|
||||
info("Opening Debugger");
|
||||
await openDebugger();
|
||||
|
@ -66,7 +73,7 @@ async function performTests() {
|
|||
|
||||
info("Waiting for pause");
|
||||
await pauseDebugger(dbg);
|
||||
const stackFrames = dbg.selectors.getCallStackFrames(dbg.getState());
|
||||
const stackFrames = dbg.selectors.getCallStackFrames();
|
||||
|
||||
info("Opening Console again");
|
||||
await toolbox.selectTool("webconsole");
|
||||
|
@ -74,8 +81,11 @@ async function performTests() {
|
|||
// Test if 'foo' gives 'foo3' and 'foo1' but not 'foo2', since we are paused in
|
||||
// the `secondCall` function (called by `firstCall`, which we call in `pauseDebugger`).
|
||||
await jstermComplete("foo");
|
||||
is(getPopupLabels(popup).join("-"), "foo1-foo1Obj-foo3-foo3Obj",
|
||||
`"foo" gave the expected suggestions`);
|
||||
is(
|
||||
getPopupLabels(popup).join("-"),
|
||||
"foo1-foo1Obj-foo3-foo3Obj",
|
||||
`"foo" gave the expected suggestions`
|
||||
);
|
||||
|
||||
await openDebugger();
|
||||
|
||||
|
@ -88,8 +98,11 @@ async function performTests() {
|
|||
// Test if 'foo' gives 'foo2' and 'foo1' but not 'foo3', since we are now in the
|
||||
// `firstCall` frame.
|
||||
await jstermComplete("foo");
|
||||
is(getPopupLabels(popup).join("-"), "foo1-foo1Obj-foo2-foo2Obj",
|
||||
`"foo" gave the expected suggestions`);
|
||||
is(
|
||||
getPopupLabels(popup).join("-"),
|
||||
"foo1-foo1Obj-foo2-foo2Obj",
|
||||
`"foo" gave the expected suggestions`
|
||||
);
|
||||
|
||||
// Test if 'foo2Obj.' gives 'prop1'
|
||||
await jstermComplete("foo2Obj.");
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
|
||||
requestLongerTimeout(5);
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
const TEST_URI =
|
||||
"http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/mochitest/" +
|
||||
"test-click-function-to-source.html";
|
||||
|
||||
const TEST_SCRIPT_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
const TEST_SCRIPT_URI =
|
||||
"http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/mochitest/" +
|
||||
"test-click-function-to-source.js";
|
||||
|
||||
|
@ -31,7 +33,7 @@ add_task(async function() {
|
|||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
|
||||
content.wrappedJSObject.foo();
|
||||
});
|
||||
const {node} = await onLoggedFunction;
|
||||
const { node } = await onLoggedFunction;
|
||||
const jumpIcon = node.querySelector(".jump-definition");
|
||||
ok(jumpIcon, "A jump to definition button is rendered, as expected");
|
||||
|
||||
|
@ -42,7 +44,7 @@ add_task(async function() {
|
|||
const dbg = createDebuggerContext(toolbox);
|
||||
await waitForSelectedSource(dbg, TEST_SCRIPT_URI);
|
||||
|
||||
const pendingLocation = dbg.selectors.getPendingSelectedLocation(dbg.getState());
|
||||
const {line} = pendingLocation;
|
||||
const pendingLocation = dbg.selectors.getPendingSelectedLocation();
|
||||
const { line } = pendingLocation;
|
||||
is(line, 9, "Debugger is open at the expected line");
|
||||
});
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
"use strict";
|
||||
/* import-globals-from head.js*/
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
const TEST_URI =
|
||||
"http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/mochitest/test-eval-in-stackframe.html";
|
||||
|
||||
add_task(async function() {
|
||||
info("open the console");
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
const {jsterm} = hud;
|
||||
const { jsterm } = hud;
|
||||
|
||||
info("Check `foo` value");
|
||||
let onResultMessage = waitForMessage(hud, "globalFooBug783499");
|
||||
|
@ -45,7 +46,7 @@ add_task(async function() {
|
|||
await openDebugger();
|
||||
await pauseDebugger(dbg);
|
||||
|
||||
const stackFrames = dbg.selectors.getCallStackFrames(dbg.getState());
|
||||
const stackFrames = dbg.selectors.getCallStackFrames();
|
||||
|
||||
info("frames added, select the console again");
|
||||
await openConsole();
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
const TEST_URI =
|
||||
"http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/mochitest/test-eval-in-stackframe.html";
|
||||
|
||||
add_task(async function() {
|
||||
info("open the console");
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
const {jsterm} = hud;
|
||||
const { jsterm } = hud;
|
||||
|
||||
info("open the debugger");
|
||||
await openDebugger();
|
||||
|
@ -55,9 +56,11 @@ add_task(async function() {
|
|||
ok(firstCallEvaluationResult === unresolvedSymbol, "firstCall was not evaluated yet");
|
||||
|
||||
info("Resuming the thread");
|
||||
dbg.actions.resume(dbg.selectors.getThreadContext(dbg.getState()));
|
||||
dbg.actions.resume(dbg.selectors.getThreadContext());
|
||||
|
||||
message = await onFirstCallMessageReceived;
|
||||
ok(firstCallEvaluationResult !== unresolvedSymbol,
|
||||
"firstCall() returned correct value");
|
||||
ok(
|
||||
firstCallEvaluationResult !== unresolvedSymbol,
|
||||
"firstCall() returned correct value"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1203,7 +1203,7 @@ function isConfirmDialogOpened(toolbox) {
|
|||
|
||||
async function selectFrame(dbg, frame) {
|
||||
const onScopes = waitForDispatch(dbg, "ADD_SCOPES");
|
||||
await dbg.actions.selectFrame(dbg.selectors.getThreadContext(dbg.getState()), frame);
|
||||
await dbg.actions.selectFrame(dbg.selectors.getThreadContext(), frame);
|
||||
await onScopes;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче