Merge autoland to mozilla-central. a=merge

This commit is contained in:
Butkovits Atila 2022-02-21 23:23:21 +02:00
Родитель 2b5f2902b3 b138ba1676
Коммит ad38c9d1f0
154 изменённых файлов: 4010 добавлений и 2772 удалений

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

@ -133,16 +133,9 @@ RootAccessibleWrap::HandleEvent(Event* aDOMEvent) {
return NS_OK;
}
MouseEvent* mouseEvent = aDOMEvent->AsMouseEvent();
if (mouseEvent) {
nsPresContext* pc = PresContext();
int32_t x =
pc->CSSPixelsToDevPixels(mouseEvent->ScreenX(CallerType::System));
int32_t y =
pc->CSSPixelsToDevPixels(mouseEvent->ScreenY(CallerType::System));
ExploreByTouch(x, y);
if (MouseEvent* mouseEvent = aDOMEvent->AsMouseEvent()) {
LayoutDeviceIntPoint point = mouseEvent->ScreenPointLayoutDevicePix();
ExploreByTouch(point.x, point.y);
}
return NS_OK;

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

@ -2405,7 +2405,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"1": 1
"0": 0
}
}
}
@ -2426,7 +2426,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"1": 1
"0": 0
}
}
}

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

@ -7930,6 +7930,12 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
* 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 networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {

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

@ -527,6 +527,12 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
* 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 networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {

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

@ -103,6 +103,12 @@ module.exports = {
* 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 networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {

6
devtools/client/debugger/dist/vendors.js поставляемый
Просмотреть файл

@ -117,6 +117,12 @@ module.exports = {
* 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 networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {

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

@ -3,6 +3,11 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
function networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache",
}).then(res => {

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

@ -5,10 +5,10 @@
// Tests async stepping will step over await statements
add_task(async function test() {
await pushPref("devtools.debugger.features.async-stepping", true);
const dbg = await initDebugger("doc-async.html", "async");
const dbg = await initDebugger("doc-async.html", "async.js");
await selectSource(dbg, "async");
await addBreakpoint(dbg, "async", 8);
await selectSource(dbg, "async.js");
await addBreakpoint(dbg, "async.js", 8);
invokeInTab("main");
await waitForPaused(dbg);

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

@ -28,8 +28,8 @@ add_task(async function testAllBlackBox() {
const source = findSource(dbg, file);
await selectSource(dbg, source.url);
await waitForSelectedSource(dbg, source.url);
await selectSource(dbg, source);
await waitForSelectedSource(dbg, source);
await addBreakpoint(dbg, file, 8);
@ -47,8 +47,8 @@ add_task(async function testBlackBoxOnReload() {
const source = findSource(dbg, file);
await selectSource(dbg, source.url);
await waitForSelectedSource(dbg, source.url);
await selectSource(dbg, source);
await waitForSelectedSource(dbg, source);
// Adding 2 breakpoints in funcB() and funcC() which
// would be hit in order.

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

@ -10,7 +10,7 @@ add_task(async function testBreakableLinesOverReloads() {
const dbg = await initDebuggerWithAbsoluteURL(TEST_URL, "index.html", "script.js", "original.js");
info("Assert breakable lines of the first html page load");
await assertBreakableLines(dbg, "index.html", 20, [[16], [17]]);
await assertBreakableLines(dbg, "index.html", 20, [[17], [18]]);
info("Assert breakable lines of the first original source file, original.js");
// The length of original.js is longer than the test file
@ -30,7 +30,7 @@ add_task(async function testBreakableLinesOverReloads() {
await assertBreakableLines(dbg, "script.js", 23, [[2], [13,23]]);
info("Assert breakable lines of the second html page load");
await assertBreakableLines(dbg, "index.html", 21, [[15], [17]]);
await assertBreakableLines(dbg, "index.html", 22, [[16], [18]]);
info("Assert breakable lines of the second orignal file");
// See first assertion about original.js,

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

@ -27,8 +27,8 @@ add_task(async function testBreakableLinesOverReloads() {
info("Assert breakable lines of the first html page load");
await assertBreakablePositions(dbg, "index.html", 20, [
{ line: 16, columns: [6, 14] },
{ line: 17, columns: [] },
{ line: 17, columns: [6, 14] },
{ line: 18, columns: [] },
]);
info("Assert breakable lines of the first original source file, original.js");
@ -75,9 +75,9 @@ add_task(async function testBreakableLinesOverReloads() {
]);
info("Assert breakable lines of the second html page load");
await assertBreakablePositions(dbg, "index.html", 21, [
{ line: 15, columns: [6, 14] },
{ line: 17, columns: [] },
await assertBreakablePositions(dbg, "index.html", 22, [
{ line: 16, columns: [6, 14] },
{ line: 18, columns: [] },
]);
info("Assert breakable lines of the second orignal file");

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

@ -11,11 +11,11 @@ add_task(async function() {
getState,
} = dbg;
await selectSource(dbg, "scripts.html");
await selectSource(dbg, "doc-scripts.html");
// Make sure we can set a top-level breakpoint and it will be hit on
// reload.
await addBreakpoint(dbg, "scripts.html", 21);
await addBreakpoint(dbg, "doc-scripts.html", 21);
reload(dbg);

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

@ -9,12 +9,12 @@
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");
await selectSource(dbg, "simple3");
await selectSource(dbg, "simple3.js");
info("Adding a breakpoint should remove the skipped pausing state");
await skipPausing(dbg);
await waitForState(dbg, state => dbg.selectors.getSkipPausing());
await addBreakpoint(dbg, "simple3", 2);
await addBreakpoint(dbg, "simple3.js", 2);
await waitForState(dbg, state => !dbg.selectors.getSkipPausing());
invokeInTab("simple");
await waitForPaused(dbg);
@ -40,7 +40,7 @@ add_task(async function() {
await resume(dbg);
info("Disabling a breakpoint should remove the skipped pausing state");
await addBreakpoint(dbg, "simple3", 3);
await addBreakpoint(dbg, "simple3.js", 3);
await skipPausing(dbg);
await disableBreakpoint(dbg, 0);
await waitForState(dbg, state => !dbg.selectors.getSkipPausing());

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

@ -4,11 +4,11 @@
// Tests to see if we can trigger a breakpoint action via the context menu
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple2");
await selectSource(dbg, "simple2");
await waitForSelectedSource(dbg, "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
await selectSource(dbg, "simple2.js");
await waitForSelectedSource(dbg, "simple2.js");
await addBreakpoint(dbg, "simple2", 3);
await addBreakpoint(dbg, "simple2.js", 3);
await openFirstBreakpointContextMenu(dbg);
// select "Remove breakpoint"
@ -21,12 +21,12 @@ add_task(async function() {
// Tests "disable others", "enable others" and "remove others" context actions
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");
await selectSource(dbg, "simple1");
await waitForSelectedSource(dbg, "simple1");
await selectSource(dbg, "simple1.js");
await waitForSelectedSource(dbg, "simple1.js");
await addBreakpoint(dbg, "simple1", 4);
await addBreakpoint(dbg, "simple1", 5);
await addBreakpoint(dbg, "simple1", 6);
await addBreakpoint(dbg, "simple1.js", 4);
await addBreakpoint(dbg, "simple1.js", 5);
await addBreakpoint(dbg, "simple1.js", 6);
await openFirstBreakpointContextMenu(dbg);
// select "Disable Others"

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

@ -3,8 +3,8 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1");
await selectSource(dbg, "long");
const dbg = await initDebugger("doc-scripts.html", "simple1.js");
await selectSource(dbg, "long.js");
info("1. Add a column breakpoint on line 32");
await enableFirstBreakpoint(dbg);
@ -39,7 +39,7 @@ add_task(async function() {
async function enableFirstBreakpoint(dbg) {
getCM(dbg).setCursor({ line: 32, ch: 0 });
await addBreakpoint(dbg, "long", 32);
await addBreakpoint(dbg, "long.js", 32);
const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
ok(bpMarkers.length === 2, "2 column breakpoints");

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

@ -6,12 +6,12 @@
// Should access the closest breakpoint to a passed in cursorPosition.
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "long");
const dbg = await initDebugger("doc-scripts.html", "long.js");
let cursorPosition = { line: undefined, column: undefined };
await selectSource(dbg, "long");
await waitForSelectedSource(dbg, "long");
await selectSource(dbg, "long.js");
await waitForSelectedSource(dbg, "long.js");
info("toggle conditional panel with shortcut: no breakpoints, default cursorPosition");
pressKey(dbg, "toggleCondPanel");
@ -52,7 +52,7 @@ add_task(async function() {
info("toggle conditional panel with shortcut and add condition to first breakpoint");
setConditionalBreakpoint(dbg, "1");
await waitForCondition(dbg, 1);
const firstBreakpoint = findColumnBreakpoint(dbg, "long", 32, 2);
const firstBreakpoint = findColumnBreakpoint(dbg, "long.js", 32, 2);
is(firstBreakpoint.options.condition, "1", "first breakpoint created with condition using shortcut");
info("set cursor at second breakpoint position and activate breakpoint");
@ -62,7 +62,7 @@ add_task(async function() {
info("toggle conditional panel with shortcut and add condition to second breakpoint");
setConditionalBreakpoint(dbg, "2");
await waitForCondition(dbg, 2);
const secondBreakpoint = findColumnBreakpoint(dbg, "long", 32, 26);
const secondBreakpoint = findColumnBreakpoint(dbg, "long.js", 32, 26);
is(secondBreakpoint.options.condition, "2", "second breakpoint created with condition using shortcut");
info("set cursor position near first breakpoint, toggle conditional panel and edit breakpoint");
@ -100,7 +100,7 @@ async function waitForConditionalPanelFocus(dbg) {
// from browser_dbg-breakpoints-columns.js
async function enableFirstBreakpoint(dbg) {
getCM(dbg).setCursor({ line: 32, ch: 0 });
await addBreakpoint(dbg, "long", 32);
await addBreakpoint(dbg, "long.js", 32);
const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
ok(bpMarkers.length === 2, "2 column breakpoints");

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

@ -3,17 +3,17 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
await pushPref("devtools.debugger.features.column-breakpoints", true);
await selectSource(dbg, "simple2");
await waitForSelectedSource(dbg, "simple2");
await selectSource(dbg, "simple2.js");
await waitForSelectedSource(dbg, "simple2.js");
info("Set condition `1`");
await setConditionalBreakpoint(dbg, 5, "1");
await waitForCondition(dbg, 1);
let bp = findBreakpoint(dbg, "simple2", 5);
let bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.condition, "1", "breakpoint is created with the condition");
await assertConditionBreakpoint(dbg, 5);
@ -21,7 +21,7 @@ add_task(async function() {
await setConditionalBreakpoint(dbg, 5, "2");
await waitForCondition(dbg, 12);
bp = findBreakpoint(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.condition, "12", "breakpoint is created with the condition");
await assertConditionBreakpoint(dbg, 5);
@ -34,7 +34,7 @@ add_task(async function() {
pressKey(dbg, "Enter");
await waitForCondition(dbg, 12);
bp = findBreakpoint(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.condition, "12", "Hit 'Enter' doesn't add a new line");
info("Hit 'Alt+Enter' when the cursor is in the conditional statement");
@ -47,12 +47,12 @@ add_task(async function() {
pressKey(dbg, "Enter");
await waitForCondition(dbg, "1\n2");
bp = findBreakpoint(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.condition, "1\n2", "Hit 'Alt+Enter' adds a new line");
clickElement(dbg, "gutter", 5);
await waitForDispatch(dbg.store, "REMOVE_BREAKPOINT");
bp = findBreakpoint(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp, undefined, "breakpoint was removed");
await assertNoBreakpoint(dbg, 5);
@ -62,7 +62,7 @@ add_task(async function() {
await setConditionalBreakpoint(dbg, 5, "1");
await waitForCondition(dbg, 1);
bp = findBreakpoint(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.condition, "1", "breakpoint is created with the condition");
await assertConditionBreakpoint(dbg, 5);
@ -83,8 +83,8 @@ add_task(async function() {
await waitForContextMenu(dbg);
info('select "remove condition"');
selectContextMenuItem(dbg, selectors.breakpointContextMenu.removeCondition);
await waitForBreakpointWithoutCondition(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2", 5);
await waitForBreakpointWithoutCondition(dbg, "simple2.js", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.condition, null, "breakpoint condition removed");
info('Add "log point"');
@ -92,11 +92,11 @@ add_task(async function() {
await waitForLog(dbg, 44);
await assertLogBreakpoint(dbg, 5);
bp = findBreakpoint(dbg, "simple2", 5);
bp = findBreakpoint(dbg, "simple2.js", 5);
is(bp.options.logValue, "44", "breakpoint condition removed");
await altClickElement(dbg, "gutter", 6);
bp = await waitForBreakpoint(dbg, "simple2", 6);
bp = await waitForBreakpoint(dbg, "simple2.js", 6);
is(bp.options.logValue, "displayName", "logPoint has default value");
info("Double click the logpoint in secondary pane");

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

@ -8,14 +8,14 @@
add_task(async function() {
const dbg = await initDebugger(
"doc-duplicate-functions.html",
"doc-duplicate-functions"
"doc-duplicate-functions.html"
);
let source = findSource(dbg, "doc-duplicate-functions");
let source = findSource(dbg, "doc-duplicate-functions.html");
await selectSource(dbg, source.url);
await addBreakpoint(dbg, source.url, 21);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 21);
await reload(dbg, "doc-duplicate-functions");
await reload(dbg, "doc-duplicate-functions.html");
await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 1);
@ -27,7 +27,7 @@ add_task(async function() {
invokeInTab("func");
await waitForPaused(dbg);
source = findSource(dbg, "doc-duplicate-functions");
source = findSource(dbg, "doc-duplicate-functions.html");
assertPausedAtSourceAndLine(dbg, source.id, 21);
await assertBreakpoint(dbg, 21);

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

@ -63,8 +63,8 @@ add_task(async function testPausedByBreakpoint() {
const firstPopupBrowsingContext = await openPopup(POPUP_URL);
const source = await waitForSource(dbg, POPUP_URL);
await selectSource(dbg, source.url);
await addBreakpoint(dbg, source.url, 4);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 4);
info("Now close and reopen the popup");
await closePopup(firstPopupBrowsingContext);
@ -123,8 +123,8 @@ add_task(async function testPausedInTwoPopups() {
const popupBrowsingContext = await openPopup(POPUP_URL);
const source = await waitForSource(dbg, POPUP_URL);
await selectSource(dbg, source.url);
await addBreakpoint(dbg, source.url, 4);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 4);
info("Now close and reopen the popup");
await closePopup(popupBrowsingContext);

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

@ -83,10 +83,10 @@ add_task(async function testBreakpointInFunctionRelocation() {
const dbg = await initDebuggerWithAbsoluteURL(BASE_URL + "doc-breakpoint-reload.html", "script.js");
let source = findSource(dbg, "script.js");
await selectSource(dbg, source.url);
await selectSource(dbg, source);
info("Add breakpoint in bar()")
await addBreakpoint(dbg, source.url, 3);
await addBreakpoint(dbg, source, 3);
info("Assert the text content on line 3 to make sure the breakpoint was set in bar()");
assertTextContentOnLine(dbg, 3, 'return prefix + "bar";');

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

@ -10,7 +10,11 @@
const testServer = createVersionizedHttpTestServer("sourcemaps-reload");
const TEST_URL = testServer.urlFor("index.html");
add_task(async function() {
/**
* This first test will focus on original.js file whose content changes
* which affects the related generated file: bundle.js
*/
add_task(async function testReloadingStableOriginalSource() {
const dbg = await initDebuggerWithAbsoluteURL(TEST_URL, "original.js");
info("Add initial breakpoint");
@ -105,3 +109,70 @@ add_task(async function() {
assertNotPaused(dbg);
is(dbg.selectors.getBreakpointCount(dbg), 0, "No breakpoints");
});
/**
* This second test will focus on removed-original.js which is an original source mapped file.
* This source is mapped to replaced-bundle.js.
* This original source is removed and another original file: new-original.js
* will replace the content of the removed-original.js in the replaced-bundle.js generated file.
* And finally, everything is removed, both original and generated source.
*/
add_task(async function testReloadingReplacedOriginalSource() {
testServer.backToFirstVersion();
const dbg = await initDebuggerWithAbsoluteURL(TEST_URL, "removed-original.js");
info("Add initial breakpoint");
await selectSource(dbg, "removed-original.js");
await addBreakpoint(dbg, "removed-original.js", 2);
// Assert the precise behavior of the breakpoint before reloading
invokeInTab("removedOriginal");
await waitForPaused(dbg);
const replacedSource = findSource(dbg, "removed-original.js");
assertPausedAtSourceAndLine(dbg, replacedSource.id, 2);
assertTextContentOnLine(dbg, 2, 'console.log("Removed original");');
await assertBreakpoint(dbg, 2);
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
let breakpoint = dbg.selectors.getBreakpointsList()[0];
is(breakpoint.location.sourceUrl, replacedSource.url);
is(breakpoint.location.line, 2);
is(breakpoint.generatedLocation.line, 78);
await resume(dbg);
info("Reload, which should remove the original file and a add a new original file which will replace its content in the generated file");
const syncBp = waitForDispatch(dbg.store, "SET_BREAKPOINT");
testServer.switchToNextVersion();
await reload(dbg);
await syncBp;
// Assert the new breakpoint being created after reload
// For now, the current behavior of the debugger is that:
// the breakpoint is still hit based on the generated source/bundle file
// and the UI updates itself to mention the new original file.
await waitForPaused(dbg);
const newSource = findSource(dbg, "new-original.js");
assertPausedAtSourceAndLine(dbg, newSource.id, 2);
assertTextContentOnLine(dbg, 2, 'console.log("New original");');
await assertBreakpoint(dbg, 2);
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
breakpoint = dbg.selectors.getBreakpointsList()[0];
is(breakpoint.location.sourceUrl, newSource.url);
is(breakpoint.location.line, 2);
is(breakpoint.generatedLocation.line, 78);
info("Reload a last time to remove both original and generated sources entirely");
testServer.switchToNextVersion();
await reload(dbg);
// Let some time for breakpoint syncing to be buggy and recreated unexpected breakpoint
await wait(1000);
info("Assert that sources and breakpoints are gone and we aren't paused");
ok(!sourceExists(dbg, "removed-original.js"), "removed-original is not present");
ok(!sourceExists(dbg, "new-original.js"), "new-original is not present");
ok(!sourceExists(dbg, "replaced-bundle.js"), "replaced-bundle is not present");
assertNotPaused(dbg);
is(dbg.selectors.getBreakpointCount(), 0, "We no longer have any breakpoint");
});

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

@ -4,33 +4,33 @@
// Test enabling and disabling a breakpoint using the check boxes
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
// Create two breakpoints
await selectSource(dbg, "simple2");
await addBreakpoint(dbg, "simple2", 3);
await addBreakpoint(dbg, "simple2", 5);
await selectSource(dbg, "simple2.js");
await addBreakpoint(dbg, "simple2.js", 3);
await addBreakpoint(dbg, "simple2.js", 5);
// Disable the first one
await disableBreakpoint(dbg, 0);
let bp1 = findBreakpoint(dbg, "simple2", 3);
let bp2 = findBreakpoint(dbg, "simple2", 5);
let bp1 = findBreakpoint(dbg, "simple2.js", 3);
let bp2 = findBreakpoint(dbg, "simple2.js", 5);
is(bp1.disabled, true, "first breakpoint is disabled");
is(bp2.disabled, false, "second breakpoint is enabled");
// Disable and Re-Enable the second one
await disableBreakpoint(dbg, 1);
await enableBreakpoint(dbg, 1);
bp2 = findBreakpoint(dbg, "simple2", 5);
bp2 = findBreakpoint(dbg, "simple2.js", 5);
is(bp2.disabled, false, "second breakpoint is enabled");
// Cleanup
await cleanupBreakpoints(dbg);
// Test enabling and disabling a breakpoint using the context menu
await selectSource(dbg, "simple2");
await addBreakpoint(dbg, "simple2", 3);
await addBreakpoint(dbg, "simple2", 5);
await selectSource(dbg, "simple2.js");
await addBreakpoint(dbg, "simple2.js", 3);
await addBreakpoint(dbg, "simple2.js", 5);
assertEmptyLines(dbg, [1, 2]);
assertBreakpointSnippet(dbg, 3, "return x + y;");
@ -41,8 +41,8 @@ add_task(async function() {
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableSelf);
await disableBreakpointDispatch;
bp1 = findBreakpoint(dbg, "simple2", 3);
bp2 = findBreakpoint(dbg, "simple2", 5);
bp1 = findBreakpoint(dbg, "simple2.js", 3);
bp2 = findBreakpoint(dbg, "simple2.js", 5);
is(bp1.disabled, true, "first breakpoint is disabled");
is(bp2.disabled, false, "second breakpoint is enabled");
@ -52,8 +52,8 @@ add_task(async function() {
selectContextMenuItem(dbg, selectors.breakpointContextMenu.enableSelf);
await enableBreakpointDispatch;
bp1 = findBreakpoint(dbg, "simple2", 3);
bp2 = findBreakpoint(dbg, "simple2", 5);
bp1 = findBreakpoint(dbg, "simple2.js", 3);
bp2 = findBreakpoint(dbg, "simple2.js", 5);
is(bp1.disabled, false, "first breakpoint is enabled");
is(bp2.disabled, false, "second breakpoint is enabled");
@ -62,9 +62,9 @@ add_task(async function() {
// Test creation of disabled breakpoint with shift-click
await shiftClickElement(dbg, "gutter", 3);
await waitForBreakpoint(dbg, "simple2", 3);
await waitForBreakpoint(dbg, "simple2.js", 3);
const bp = findBreakpoint(dbg, "simple2", 3);
const bp = findBreakpoint(dbg, "simple2.js", 3);
is(bp.disabled, true, "breakpoint is disabled");
// Cleanup
@ -92,6 +92,6 @@ async function enableBreakpoint(dbg, index) {
async function cleanupBreakpoints(dbg) {
clickElement(dbg, "gutter", 3);
clickElement(dbg, "gutter", 5);
await waitForBreakpointRemoved(dbg, "simple2", 3);
await waitForBreakpointRemoved(dbg, "simple2", 5);
await waitForBreakpointRemoved(dbg, "simple2.js", 3);
await waitForBreakpointRemoved(dbg, "simple2.js", 5);
}

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

@ -28,17 +28,17 @@ add_task(async function() {
ok(dbg, "Debugger context is available");
info("Create a breakpoint");
await selectSource(dbg, "simple2");
await addBreakpoint(dbg, "simple2", 3);
await selectSource(dbg, "simple2.js");
await addBreakpoint(dbg, "simple2.js", 3);
info("Disable the breakpoint");
await disableBreakpoint(dbg, 0);
let bp = findBreakpoint(dbg, "simple2", 3);
let bp = findBreakpoint(dbg, "simple2.js", 3);
is(bp.disabled, true, "breakpoint is disabled");
info("Enable the breakpoint");
await enableBreakpoint(dbg, 0);
bp = findBreakpoint(dbg, "simple2", 3);
bp = findBreakpoint(dbg, "simple2.js", 3);
is(bp.disabled, false, "breakpoint is enabled");
info("Close the browser toolbox window");

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

@ -11,8 +11,8 @@ add_task(async function() {
const source = findSource(dbg, "simple4.js");
await selectSource(dbg, source.url);
await waitForSelectedSource(dbg, source.url);
await selectSource(dbg, source);
await waitForSelectedSource(dbg, source);
invokeInTab("funcA");

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

@ -9,9 +9,9 @@ add_task(async function() {
true
);
const dbg = await initDebugger("doc-script-switching.html", "switching-01");
const dbg = await initDebugger("doc-script-switching.html", "script-switching-01.js");
await selectSource(dbg, "switching-01");
await selectSource(dbg, "script-switching-01.js");
// open the console
await getDebuggerSplitConsole(dbg);

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

@ -6,9 +6,9 @@
// opens the Inspector panel
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
await selectSource(dbg, "simple2", 1);
await selectSource(dbg, "simple2.js", 1);
clickElement(dbg, "CodeMirrorLines");
await waitForElementWithSelector(dbg, ".CodeMirror-code");

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

@ -15,7 +15,7 @@ add_task(async function() {
await waitFor(() => toolbox.getPanel("jsdebugger"));
const dbg = createDebuggerContext(toolbox);
await waitForElementWithSelector(dbg, ".CodeMirror-code > .highlight-line");
assertHighlightLocation(dbg, "script-switching-02", 14);
assertHighlightLocation(dbg, "script-switching-02.js", 14);
});
async function waitForLink(toolbox, messageText) {

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

@ -4,9 +4,9 @@
add_task(async function() {
Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
const dbg = await initDebugger("doc-script-switching.html", "switching-01");
const dbg = await initDebugger("doc-script-switching.html", "script-switching-01.js");
await selectSource(dbg, "switching-01");
await selectSource(dbg, "script-switching-01.js");
// open the console
await getDebuggerSplitConsole(dbg);

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

@ -15,7 +15,7 @@ add_task(async function() {
await reload(dbg);
await waitForPaused(dbg);
await waitForLoadedSource(dbg, "debugger-statements.html");
await waitForLoadedSource(dbg, "doc-debugger-statements.html");
assertPausedLocation(dbg);
info("resume");

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

@ -14,7 +14,7 @@ add_task(async function() {
const { getState } = dbg;
const source = findSource(dbg, "simple1.js");
await selectSource(dbg, source.url);
await selectSource(dbg, source);
// Make sure that clicking the gutter creates a breakpoint icon.
await clickGutter(dbg, 4);

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

@ -11,13 +11,12 @@ add_task(async function() {
const {
selectors: { getSource, getSourceContent }
} = dbg;
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
// and highlight a specific line.
await selectSource(dbg, sourceUrl, 66);
await selectSource(dbg, "long.js", 66);
// TODO: revisit highlighting lines when the debugger opens
// assertHighlightLocation(dbg, "long.js", 66);

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

@ -11,22 +11,21 @@ add_task(async function() {
// which is the slowest part of this and make it run faster, but to
// fix a frequent failure allow a longer timeout.
const dbg = await initDebugger("doc-editor-scroll.html");
const simple1 = findSource(dbg, "simple1.js");
// Set the initial breakpoint.
await selectSource(dbg, "simple1");
await addBreakpoint(dbg, simple1, 26);
await selectSource(dbg, "simple1.js");
await addBreakpoint(dbg, "simple1.js", 26);
const cm = getCM(dbg);
info("Open long file, scroll down to line below the fold");
await selectSource(dbg, "long");
await selectSource(dbg, "long.js");
cm.scrollTo(0, 600);
info("Ensure vertical scroll is the same after switching documents");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple1.js");
is(cm.getScrollInfo().top, 0);
await selectSource(dbg, "long");
await selectSource(dbg, "long.js");
is(cm.getScrollInfo().top, 600);
info("Trigger a pause, click on a frame, ensure the right line is selected");
@ -37,10 +36,10 @@ add_task(async function() {
ok(cm.getScrollInfo().top != 0, "frame scrolled down to correct location");
info("Navigating while paused, goes to the correct location");
await selectSource(dbg, "long");
await selectSource(dbg, "long.js");
is(cm.getScrollInfo().top, 600);
info("Open new source, ensure it's at 0 scroll");
await selectSource(dbg, "frames");
await selectSource(dbg, "frames.js");
is(cm.getScrollInfo().top, 0);
});

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

@ -19,19 +19,19 @@ add_task(async function() {
const simple2 = findSource(dbg, "simple2.js");
info("Set the initial breakpoint.");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple1.js");
await addBreakpoint(dbg, simple1, 4);
info("Call the function that we set a breakpoint in.");
invokeInTab("main");
await waitForPaused(dbg);
await waitForSelectedSource(dbg, "simple1");
await waitForSelectedSource(dbg, "simple1.js");
assertPausedLocation(dbg);
info("Step into another file.");
await stepOver(dbg);
await stepIn(dbg);
await waitForSelectedSource(dbg, "simple2");
await waitForSelectedSource(dbg, "simple2.js");
assertPausedLocation(dbg);
info("Step out to the initial file.");

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

@ -9,7 +9,7 @@ add_task(async function() {
await invokeWithBreakpoint(
dbg,
"mapTestFunction",
"quickstart/router.js",
"router.js",
{ line: 13, column: 2 },
async () => {
await assertScopes(dbg, [

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

@ -12,11 +12,11 @@ add_task(async function () {
const dbg = await initDebugger(
"doc-event-breakpoints-fission.html",
"event-breakpoints"
"event-breakpoints.js"
);
await selectSource(dbg, "event-breakpoints");
await waitForSelectedSource(dbg, "event-breakpoints");
await selectSource(dbg, "event-breakpoints.js");
await waitForSelectedSource(dbg, "event-breakpoints.js");
await dbg.actions.addEventListenerBreakpoints([
"event.mouse.click",

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

@ -10,10 +10,10 @@ add_task(async function() {
const dbg = await initDebugger(
"doc-event-breakpoints.html",
"event-breakpoints"
"event-breakpoints.js"
);
await selectSource(dbg, "event-breakpoints");
await waitForSelectedSource(dbg, "event-breakpoints");
await selectSource(dbg, "event-breakpoints.js");
await waitForSelectedSource(dbg, "event-breakpoints.js");
// We want to set each breakpoint individually to test adding/removing breakpoints, see Bug 1748589.
await toggleEventBreakpoint(dbg, "Mouse", "event.mouse.click");

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

@ -20,11 +20,11 @@ add_task(async function() {
is(dbg.selectors.getSourceCount(), 5, "5 sources are loaded.");
// Check that you can still break after target switching.
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple1.js");
await addBreakpoint(dbg, "simple1.js", 4);
invokeInTab("main");
await waitForPaused(dbg);
await waitForLoadedSource(dbg, "simple1");
await waitForLoadedSource(dbg, "simple1.js");
await dbg.toolbox.closeToolbox();
});

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

@ -6,8 +6,8 @@
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "long.js");
await selectSource(dbg, "long");
await waitForSelectedSource(dbg, "long");
await selectSource(dbg, "long.js");
await waitForSelectedSource(dbg, "long.js");
info('Test opening');
pressKey(dbg, "goToLine");

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

@ -10,8 +10,8 @@ add_task(async function() {
const source = findSource(dbg, "simple4.js");
await selectSource(dbg, source.url);
await waitForSelectedSource(dbg, source.url);
await selectSource(dbg, source);
await waitForSelectedSource(dbg, source);
invokeInTab("funcA");
await waitForPaused(dbg);
@ -24,4 +24,4 @@ add_task(async function() {
pressKey(dbg, "commandKeyUp");
const nocalls = dbg.win.document.querySelectorAll(".highlight-function-calls");
is(nocalls.length, 0);
});
});

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

@ -5,10 +5,10 @@
// Tests that keyboard navigation into and out of debugger code editor
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
let doc = dbg.win.document;
await selectSource(dbg, "simple2");
await selectSource(dbg, "simple2.js");
await waitForElementWithSelector(dbg, ".CodeMirror");
findElementWithSelector(dbg, ".CodeMirror").focus();

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

@ -8,15 +8,15 @@
add_task(async function() {
Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
const dbg = await initDebugger("doc-script-switching.html", "switching-01");
const dbg = await initDebugger("doc-script-switching.html", "script-switching-01.js");
const source = findSource(dbg, "switching-01");
await selectSource(dbg, "switching-01");
const source = findSource(dbg, "script-switching-01.js");
await selectSource(dbg, "script-switching-01.js");
await getDebuggerSplitConsole(dbg);
await altClickElement(dbg, "gutter", 7);
await waitForBreakpoint(dbg, "switching-01", 7);
await waitForBreakpoint(dbg, "script-switching-01.js", 7);
await dbg.actions.addBreakpoint(
getContext(dbg),

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

@ -9,10 +9,10 @@
const BREAKPOINT_LINE = 5;
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple2.js");
await selectSource(dbg, "simple2");
await waitForSelectedSource(dbg, "simple2");
await selectSource(dbg, "simple2.js");
await waitForSelectedSource(dbg, "simple2.js");
await testSimpleAndLog(dbg);
@ -21,14 +21,14 @@ add_task(async function() {
async function testSimpleAndLog(dbg) {
info("Add a simple breakpoint");
await addBreakpoint(dbg, "simple2", BREAKPOINT_LINE);
await addBreakpoint(dbg, "simple2.js", BREAKPOINT_LINE);
info("Add a log breakpoint, replacing the breakpoint into a logpoint");
await setLogPoint(dbg, BREAKPOINT_LINE, "`log point ${x}`");
await waitForLog(dbg, "`log point ${x}`");
await assertLogBreakpoint(dbg, BREAKPOINT_LINE);
const bp = findBreakpoint(dbg, "simple2", BREAKPOINT_LINE);
const bp = findBreakpoint(dbg, "simple2.js", BREAKPOINT_LINE);
is(bp.options.logValue, "`log point ${x}`", "log breakpoint value is correct");
info("Eval foo() and trigger the breakpoints. If this freeze here, it means that the log point has been ignored.");
@ -49,7 +49,7 @@ async function testLogUpdates(dbg) {
await waitForLog(dbg, "`log point`");
await assertLogBreakpoint(dbg, BREAKPOINT_LINE);
const bp = findBreakpoint(dbg, "simple2", BREAKPOINT_LINE);
const bp = findBreakpoint(dbg, "simple2.js", BREAKPOINT_LINE);
is(bp.options.logValue, "`log point`", "log breakpoint value is correct");
info("Edit the log breakpoint");
@ -57,7 +57,7 @@ async function testLogUpdates(dbg) {
await waitForLog(dbg, "`log point` + ` edited`");
await assertLogBreakpoint(dbg, BREAKPOINT_LINE);
const bp2 = findBreakpoint(dbg, "simple2", BREAKPOINT_LINE);
const bp2 = findBreakpoint(dbg, "simple2.js", BREAKPOINT_LINE);
is(bp2.options.logValue, "`log point` + ` edited`", "log breakpoint value is correct");
info("Eval foo() and trigger the breakpoints");

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

@ -7,7 +7,7 @@ const SOURCES = [
"simple2.js",
"simple3.js",
"long.js",
"scripts.html"
"doc-scripts.html"
];
/**
@ -29,7 +29,7 @@ add_task(async function() {
await navigate(dbg, "doc-scripts.html", "simple1.js");
info("Set a breakpoint on the second document and pause on it");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple1.js");
await addBreakpoint(dbg, "simple1.js", 4);
invokeInTab("main");
await waitForPaused(dbg);

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

@ -4,8 +4,8 @@
// Tests the outline pane fuzzy filtering of outline items
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "long");
await selectSource(dbg, "long", 1);
const dbg = await initDebugger("doc-scripts.html", "long.js");
await selectSource(dbg, "long.js", 1);
findElementWithSelector(dbg, ".outline-tab").click();
// turn off alphetical sort if active

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

@ -5,9 +5,9 @@
// Tests that after clicking a function in edtior, outline focuses that function
add_task(async function() {
const dbg = await initDebugger("doc-sources.html", "long");
const dbg = await initDebugger("doc-sources.html", "long.js");
await selectSource(dbg, "long", 1);
await selectSource(dbg, "long.js", 1);
findElementWithSelector(dbg, ".outline-tab").click();
is(getItems(dbg).length, 9, "9 items in the outline list");

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

@ -4,13 +4,13 @@
// Tests that the length of outline functions for original and pretty printed source matches
add_task(async function () {
const dbg = await initDebugger("doc-scripts.html", "simple1");
const dbg = await initDebugger("doc-scripts.html", "simple1.js");
const {
selectors: { getSelectedSource },
getState
} = dbg;
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple1.js");
findElementWithSelector(dbg, ".outline-tab").click();
const originalSource = getItems(dbg);

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

@ -5,13 +5,13 @@
// Tests that clicking a function in outline panel, the editor highlights the correct location.
// Tests that outline panel can sort functions alphabetically.
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1");
const dbg = await initDebugger("doc-scripts.html", "simple1.js");
const {
selectors: { getSelectedSource },
getState,
} = dbg;
await selectSource(dbg, "simple1", 1);
await selectSource(dbg, "simple1.js", 1);
findElementWithSelector(dbg, ".outline-tab").click();
@ -34,7 +34,7 @@ add_task(async function() {
info("Click an item in outline panel");
const item = getNthItem(dbg, 3);
item.click();
assertHighlightLocation(dbg, "simple1", 15);
assertHighlightLocation(dbg, "simple1.js", 15);
ok(
item.parentNode.classList.contains("focused"),
"The clicked item li is focused"

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

@ -20,7 +20,7 @@ add_task(async function() {
info("Preview should still work after selecting different locations");
const frame = dbg.selectors.getVisibleSelectedFrame();
const inScopeLines = dbg.selectors.getInScopeLines(frame.location);
await selectSource(dbg, "switching-01");
await selectSource(dbg, "script-switching-01.js");
await assertFunctionPreview(dbg, 8, 4, "secondCall()");
is(
dbg.selectors.getInScopeLines(frame.location),

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

@ -7,9 +7,8 @@
add_task(async function() {
const dbg = await initDebugger("doc-preview-getter.html", "preview-getter.js");
const source = findSource(dbg, "preview-getter.js");
await loadAndAddBreakpoint(dbg, source.url, 5, 4);
await loadAndAddBreakpoint(dbg, "preview-getter.js", 5, 4);
invokeInTab("funcA");
await waitForPaused(dbg);

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

@ -11,12 +11,12 @@ add_task(async function() {
"opts.js"
);
await selectSource(dbg, "times2");
await addBreakpoint(dbg, "times2", 2);
await selectSource(dbg, "times2.js");
await addBreakpoint(dbg, "times2.js", 2);
invokeInTab("keepMeAlive");
await waitForPaused(dbg);
await waitForSelectedSource(dbg, "times2");
await waitForSelectedSource(dbg, "times2.js");
info("Test previewing in the original location");
await assertPreviews(dbg, [
@ -31,7 +31,7 @@ add_task(async function() {
]);
info("Test that you can not preview in another original file");
await selectSource(dbg, "output");
await selectSource(dbg, "output.js");
await hoverAtPos(dbg, { line: 2, ch: 16 });
await assertNoTooltip(dbg);
});

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

@ -18,16 +18,16 @@ add_task(async function() {
pressKey(dbg, "Escape");
info("Testing source search and check to see if source is selected");
await waitForSource(dbg, "switching-01");
await waitForSource(dbg, "script-switching-01.js");
await quickOpen(dbg, "sw1");
await waitForResults(dbg, ["switching-01.js"]);
await waitForResults(dbg, ["script-switching-01.js"]);
is(resultCount(dbg), 1, "one file results");
pressKey(dbg, "Enter");
await waitForSelectedSource(dbg, "switching-01");
await waitForSelectedSource(dbg, "script-switching-01.js");
info("Test that results show tab icons");
await quickOpen(dbg, "sw1");
await waitForResults(dbg, ["switching-01.js"]);
await waitForResults(dbg, ["script-switching-01.js"]);
await assertResultIsTab(dbg, 1);
pressKey(dbg, "Tab");
@ -35,11 +35,11 @@ add_task(async function() {
"Testing arrow keys in source search and check to see if source is selected"
);
await quickOpen(dbg, "sw2");
await waitForResults(dbg, ["switching-02.js"]);
await waitForResults(dbg, ["script-switching-02.js"]);
is(resultCount(dbg), 1, "one file results");
pressKey(dbg, "Down");
pressKey(dbg, "Enter");
await waitForSelectedSource(dbg, "switching-02");
await waitForSelectedSource(dbg, "script-switching-02.js");
info("Testing tab closes the search");
await quickOpen(dbg, "sw");
@ -70,9 +70,9 @@ add_task(async function() {
info("Testing gotoSource");
await quickOpen(dbg, "sw1:5");
await waitForResults(dbg, ["switching-01.js"]);
await waitForResults(dbg, ["script-switching-01.js"]);
pressKey(dbg, "Enter");
await waitForSelectedSource(dbg, "switching-01");
await waitForSelectedSource(dbg, "script-switching-01.js");
assertLine(dbg, 5);
});

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

@ -47,7 +47,7 @@ add_task(async function() {
const ready = Promise.all([
waitForPaused(dbg),
waitForLoadedSource(dbg, "test"),
waitForLoadedSource(dbg, "test.js"),
]);
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {

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

@ -7,7 +7,7 @@ add_task(async function() {
const ready = Promise.all([
waitForPaused(dbg),
waitForLoadedSource(dbg, "switching-02"),
waitForLoadedSource(dbg, "script-switching-02.js"),
// MAP_FRAMES triggers a new Scopes panel render cycle, which introduces
// a race condition with the click event on the foo node.

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

@ -13,7 +13,7 @@ add_task(async function() {
info("Add a breakpoint, wait for pause");
const source = findSource(dbg, "simple2.js");
await selectSource(dbg, source.url);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 5);
invokeInTab("main");
await waitForPaused(dbg);

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

@ -9,9 +9,7 @@ add_task(async function() {
const {
selectors: { getActiveSearch, getFileSearchQuery },
} = dbg;
const source = findSource(dbg, "simple1.js");
await selectSource(dbg, source.url);
await selectSource(dbg, "simple1.js");
// Open search bar
pressKey(dbg, "fileSearch");

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

@ -10,9 +10,7 @@ add_task(async function() {
selectors: { getBreakpoints, getBreakpoint, getActiveSearch },
getState,
} = dbg;
const source = findSource(dbg, "simple1.js");
await selectSource(dbg, source.url);
await selectSource(dbg, "simple1.js");
const cm = getCM(dbg);
pressKey(dbg, "fileSearch");
@ -122,7 +120,7 @@ add_task(async function() {
);
// selecting another source keeps search open
await selectSource(dbg, "simple2");
await selectSource(dbg, "simple2.js");
ok(findElement(dbg, "searchField"), "Search field is still visible");
// search is always focused regardless of when or how it was opened

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

@ -4,9 +4,9 @@
// Testing basic project search
add_task(async function() {
const dbg = await initDebugger("doc-script-switching.html", "switching-01");
const dbg = await initDebugger("doc-script-switching.html", "script-switching-01.js");
await selectSource(dbg, "switching-01");
await selectSource(dbg, "script-switching-01.js");
// test opening and closing
await openProjectSearch(dbg);
@ -23,8 +23,8 @@ add_task(async function() {
is(dbg.selectors.getActiveSearch(), null);
const selectedSource = dbg.selectors.getSelectedSource();
ok(selectedSource.url.includes("switching-01"));
await waitForLoadedSource(dbg, "switching-01");
ok(selectedSource.url.includes("script-switching-01.js"));
await waitForLoadedSource(dbg, "script-switching-01.js");
});
// Test expanding search matches to reveal the search results.

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

@ -59,7 +59,7 @@ async function evalInConsoleAtPoint(
{ line, column },
statements
) {
const filename = `${target}://./${fixture}/input.`;
const url = `${target}://./${fixture}/input.js`;
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) =>
c.toUpperCase()
);
@ -67,7 +67,7 @@ async function evalInConsoleAtPoint(
await invokeWithBreakpoint(
dbg,
fnName,
filename,
url,
{ line, column },
async () => {
await assertConsoleEval(dbg, statements);
@ -87,4 +87,4 @@ async function assertConsoleEval(dbg, statements) {
const result = await dbg.client.evaluate(`window.TEST_RESULT`);
is(result.result, true, `'${statement}' evaluates to true`);
}
}
}

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

@ -21,7 +21,7 @@ async function breakpointPreviews(
{ line, column },
previews
) {
const filename = `${target}://./${fixture}/input.`;
const url = `${target}://./${fixture}/input.js`;
const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) =>
c.toUpperCase()
);
@ -31,7 +31,7 @@ async function breakpointPreviews(
await invokeWithBreakpoint(
dbg,
fnName,
filename,
url,
{ line, column },
async () => {
await assertPreviews(dbg, previews);

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

@ -55,13 +55,14 @@ async function breakpointScopes(
) {
if (!ACTIVE_TARGETS.has(target)) return;
const filename = `${target}://./${fixture}/input.`;
const extension = fixture == "typescript-classes" ? "ts" : "js";
const url = `${target}://./${fixture}/input.${extension}`;
const fnName = pairToFnName(target, fixture);
await invokeWithBreakpoint(
dbg,
fnName,
filename,
url,
{ line, column },
async () => {
await assertScopes(dbg, scopes);

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

@ -11,9 +11,9 @@ add_task(async function() {
dbg.actions.toggleMapScopes();
info("1. Pause on line 20");
const filename = "webpack3-babel6://./esmodules-cjs/input.";
await waitForSources(dbg, filename);
const source = findSource(dbg, filename);
const url = "webpack3-babel6://./esmodules-cjs/input.js";
await waitForSources(dbg, url);
const source = findSource(dbg, url);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 20, 2);
invokeInTab("webpack3Babel6EsmodulesCjs");

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

@ -4,7 +4,7 @@
// Test keyboard arrow behaviour
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.js", "simple2.js", "nested-source.js", "long.js");
await clickElement(dbg, "sourceDirectoryLabel", 3);
await assertSourceCount(dbg, 8);

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

@ -7,9 +7,9 @@
add_task(async function() {
const dbg = await initDebugger(
"doc-sources.html",
"simple1",
"simple2",
"nested-source",
"simple1.js",
"simple2.js",
"nested-source.js",
"long.js"
);
const {

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

@ -7,9 +7,9 @@
add_task(async function() {
const dbg = await initDebugger(
"doc-sources.html",
"simple1",
"simple2",
"nested-source",
"simple1.js",
"simple2.js",
"nested-source.js",
"long.js"
);
const {

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

@ -5,7 +5,7 @@
// Tests that breakpoint panels open when their relevant breakpoint is hit
add_task(async function() {
const dbg = await initDebugger("doc-sources.html", "simple1");
const dbg = await initDebugger("doc-sources.html", "simple1.js");
clickElementWithSelector(dbg, ".breakpoints-pane h2");

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

@ -6,7 +6,7 @@
requestLongerTimeout(5);
add_task(async function test() {
const dbg = await initDebugger("big-sourcemap.html", "big-sourcemap");
const dbg = await initDebugger("big-sourcemap.html", "bundle.js");
invokeInTab("hitDebugStatement");
await waitForPaused(dbg, "bundle.js");

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

@ -5,10 +5,10 @@
// Tests removing tabs with keyboard shortcuts
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple1.js", "simple2.js");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");
await selectSource(dbg, "simple1.js");
await selectSource(dbg, "simple2.js");
is(countTabs(dbg), 2);
pressKey(dbg, "close");

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

@ -5,7 +5,7 @@
// Test that URL-less sources have tabs and selecting that location does not
// create a new tab for the same URL-less source
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple1.js", "simple2.js");
// Create a URL-less source
invokeInTab("doEval");

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

@ -5,10 +5,10 @@
// Test that URL-less sources have tabs added to the UI but
// do not persist upon reload
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple1.js", "simple2.js");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");
await selectSource(dbg, "simple1.js");
await selectSource(dbg, "simple2.js");
is(countTabs(dbg), 2);
@ -23,13 +23,13 @@ add_task(async function() {
is(countTabs(dbg), 4);
// Test reloading the debugger
await reload(dbg, "simple1", "simple2");
await reload(dbg, "simple1.js", "simple2.js");
is(countTabs(dbg), 2);
// TODO: This is here to make this test less flakey because otherwise the
// test will end while the files are still loading, which will stop all
// in-progress requests causing uncaught rejections when querying
// 'getBreakpointPositionsCompressed'.
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");
await selectSource(dbg, "simple1.js");
await selectSource(dbg, "simple2.js");
});

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

@ -5,32 +5,32 @@
// Tests adding and removing tabs
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple1.js", "simple2.js");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");
await selectSource(dbg, "simple1.js");
await selectSource(dbg, "simple2.js");
is(countTabs(dbg), 2);
info("Test reloading the debugger");
await reload(dbg, "simple1", "simple2");
await reload(dbg, "simple1.js", "simple2.js");
is(countTabs(dbg), 2);
await waitForSelectedSource(dbg, "simple2.js");
info("Test reloading the debuggee a second time");
await reload(dbg, "simple1", "simple2");
await reload(dbg, "simple1.js", "simple2.js");
is(countTabs(dbg), 2);
await waitForSelectedSource(dbg, "simple2.js");
});
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple1.js", "simple2.js");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");
await closeTab(dbg, "simple1");
await closeTab(dbg, "simple2");
await selectSource(dbg, "simple1.js");
await selectSource(dbg, "simple2.js");
await closeTab(dbg, "simple1.js");
await closeTab(dbg, "simple2.js");
info("Test reloading the debugger");
await reload(dbg, "simple1", "simple2");
await reload(dbg, "simple1.js", "simple2.js");
is(countTabs(dbg), 0);
});

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

@ -7,9 +7,9 @@
// Tests that you can switch tools, without losing your editor position
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html", "long");
const dbg = await initDebugger("doc-scripts.html", "long.js");
await selectSource(dbg, "long");
await selectSource(dbg, "long.js");
getCM(dbg).scrollTo(0, 284);
pressKey(dbg, "inspector");

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

@ -68,7 +68,7 @@ add_task(async function() {
assertNotPaused(dbg);
info("Pause in both workers");
await addBreakpoint(dbg, "simple-worker", 10);
await addBreakpoint(dbg, "simple-worker.js", 10);
invokeInTab("sayHello");
info("Wait for both workers to pause");

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

@ -5,6 +5,7 @@
<html>
<script src="script.js"></script>
<script src="bundle.js"></script>
<script src="replaced-bundle.js"></script>
<head>
<meta charset="utf-8"/>
<title>Empty test page 1</title>

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

@ -0,0 +1,3 @@
window.removedOriginal = function removedOriginal() {
console.log("Removed original");
}

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

@ -0,0 +1,83 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
window.removedOriginal = function removedOriginal() {
console.log("Removed original");
};
/***/ })
/******/ ]);
//# sourceMappingURL=replaced-bundle.js.map

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

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 5cd42dca73a658e6c5e2","webpack:///./removed-original.js"],"names":["window","removedOriginal","console","log"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;;AC7DAA,OAAOC,eAAP,GAAyB,SAASA,eAAT,GAA2B;AAClDC,UAAQC,GAAR,CAAY,kBAAZ;AACD,CAFD,C","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5cd42dca73a658e6c5e2","window.removedOriginal = function removedOriginal() {\n console.log(\"Removed original\");\n}\n\n\n\n// WEBPACK FOOTER //\n// ./removed-original.js"],"sourceRoot":""}

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

@ -1,12 +1,7 @@
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js"
},
const config = {
devtool: "sourcemap",
module: {
loaders: [
@ -18,5 +13,27 @@ module.exports = {
]
},
plugins: [
]
],
};
const originalBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "original.js"),
],
output: {
path: __dirname,
filename: "bundle.js"
},
});
const replacedBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "removed-original.js"),
],
output: {
path: __dirname,
filename: "replaced-bundle.js"
},
});
module.exports = [originalBundle, replacedBundle];

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

@ -5,6 +5,7 @@
<html>
<script src="script.js"></script>
<script src="bundle.js"></script>
<script src="replaced-bundle.js"></script>
<head>
<meta charset="utf-8"/>
<title>Empty test page 2</title>

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

@ -0,0 +1,4 @@
window.newOriginal = function newOriginal() {
console.log("New original");
}
window.newOriginal();

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

@ -0,0 +1,84 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
window.newOriginal = function newOriginal() {
console.log("New original");
};
window.newOriginal();
/***/ })
/******/ ]);
//# sourceMappingURL=replaced-bundle.js.map

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

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 130724960e68b3d578a1","webpack:///./new-original.js"],"names":["window","newOriginal","console","log"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;;AC7DAA,OAAOC,WAAP,GAAqB,SAASA,WAAT,GAAuB;AAC1CC,UAAQC,GAAR,CAAY,cAAZ;AACD,CAFD;AAGAH,OAAOC,WAAP,G","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 130724960e68b3d578a1","window.newOriginal = function newOriginal() {\n console.log(\"New original\");\n}\nwindow.newOriginal();\n\n\n\n// WEBPACK FOOTER //\n// ./new-original.js"],"sourceRoot":""}

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

@ -1,12 +1,7 @@
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js"
},
const config = {
devtool: "sourcemap",
module: {
loaders: [
@ -18,5 +13,27 @@ module.exports = {
]
},
plugins: [
]
],
};
const originalBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "original.js"),
],
output: {
path: __dirname,
filename: "bundle.js"
},
});
const replacedBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "new-original.js"),
],
output: {
path: __dirname,
filename: "replaced-bundle.js"
},
});
module.exports = [originalBundle, replacedBundle];

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

@ -645,33 +645,42 @@ function pauseTest() {
return new Promise(resolve => (resumeTest = resolve));
}
// Actions
/**
* Returns a source that matches the URL.
* Returns a source that matches a given filename, or a URL.
* This also accept a source as input argument, in such case it just returns it.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {String} url
* @param {String} filenameOrUrlOrSource
* The typical case will be to pass only a filename,
* but you may also pass a full URL to match sources without filesnames like data: URL
* or pass the source itself, which is just returned.
* @param {Object} options
* @param {Boolean} options.silent
* If true, won't throw if the source is missing.
* @return {Object} source
* @static
*/
function findSource(dbg, url, { silent } = { silent: false }) {
if (typeof url !== "string") {
// Support passing in a source object itelf all APIs that use this
function findSource(dbg, filenameOrUrlOrSource, { silent } = { silent: false }) {
if (typeof filenameOrUrlOrSource !== "string") {
// Support passing in a source object itself all APIs that use this
// function support both styles
const source = url;
return source;
return filenameOrUrlOrSource;
}
const sources = dbg.selectors.getSourceList();
const source = sources.find(s => (s.url || "").includes(url));
const source = sources.find(s => {
// Sources don't have a file name attribute, we need to compute it here:
const sourceFileName = s.url ? s.url.substring(s.url.lastIndexOf("/") + 1) : "";
// The input argument may either be only the filename, or the complete URL
// This helps match sources whose URL doesn't contain a filename, like data: URLs
return sourceFileName == filenameOrUrlOrSource || s.url == filenameOrUrlOrSource;
});
if (!source) {
if (silent) {
return false;
}
throw new Error(`Unable to find source: ${url}`);
throw new Error(`Unable to find source: ${filenameOrUrlOrSource}`);
}
return source;
@ -2292,6 +2301,8 @@ async function setLogPoint(dbg, index, value) {
* Returns the absolute url for a given file.
* - switchToNextVersion()
* Start serving files from the next available sub folder.
* - backToFirstVersion()
* When running more than one test, helps restart from the first folder.
*/
function createVersionizedHttpTestServer(testFolderName) {
const httpServer = createTestHTTPServer();
@ -2321,6 +2332,9 @@ function createVersionizedHttpTestServer(testFolderName) {
switchToNextVersion() {
currentVersion++;
},
backToFirstVersion() {
currentVersion = 1;
},
urlFor(path) {
const port = httpServer.identity.primaryPort;
return `http://localhost:${port}/${path}`;

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

@ -134,5 +134,5 @@ async function waitUntilDebuggerReady(debuggerContext) {
// We have to wait until the debugger has fully loaded the source otherwise
// we will get unhandled promise rejections.
await waitForLoadedSource(debuggerContext, "data:");
await waitForLoadedSource(debuggerContext, TEST_URL);
}

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

@ -103,6 +103,12 @@ module.exports = {
* 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 networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {

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

@ -151,6 +151,12 @@ module.exports = {
* 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 networkRequest(url, opts) {
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (UNSUPPORTED_PROTOCOLS.some(protocol => url.startsWith(protocol))) {
return Promise.reject(`unsupported protocol for sourcemap request ${url}`);
}
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {

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

@ -40,6 +40,7 @@ support-files =
sjs_huge-css-server.sjs
sourcemap-css/contained.css
sourcemap-css/sourcemaps.css
sourcemap-css/sourcemaps_chrome.css
sourcemap-css/sourcemaps.css.map
# add nosniff header to test against Bug 1330383
sourcemap-css/sourcemaps.css.map^headers^
@ -63,6 +64,7 @@ support-files =
doc_long_string.css
doc_long.css
doc_short_string.css
doc_sourcemap_chrome.html
doc_xulpage.xhtml
sync.html
sync_with_csp.css
@ -116,6 +118,7 @@ skip-if = !debug && (os == "win") || (os == "linux" && os_version == "18.04") #b
[browser_styleeditor_selectstylesheet.js]
[browser_styleeditor_sourcemaps.js]
[browser_styleeditor_sourcemaps_inline.js]
[browser_styleeditor_sourcemap_chrome.js]
[browser_styleeditor_sourcemap_large.js]
[browser_styleeditor_sourcemap_watching.js]
[browser_styleeditor_sync.js]

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

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URI = URL_ROOT_SSL + "doc_sourcemap_chrome.html";
const CSS_NAME = "sourcemaps_chrome.css";
/**
* Test that a sourcemap served by a chrome URL will not be resolved
*/
add_task(async function() {
const { ui } = await openStyleEditorForURL(TEST_URI);
const editor = ui.editors[0];
// The CSS file contains a link to a sourcemap called which should map this
// CSS file to "sourcemaps.scss". If the CSS is still listed as CSS_NAME, it
// means the sourcemapped file was not resolved.
is(getStylesheetNameFor(editor), CSS_NAME, "The sourcemap was not resolved");
});
function getStylesheetNameFor(editor) {
return editor.summary
.querySelector(".stylesheet-name > label")
.getAttribute("value");
}

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

@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testcase for sourcemap URLs pointing to unsupported protocols</title>
<link rel="stylesheet" type="text/css" href="sourcemap-css/sourcemaps_chrome.css"/>
</head>
<body>
<div>Protocol test</div>
</body>
</html>

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

@ -0,0 +1,7 @@
div {
color: #ff0066; }
span {
background-color: #EEE; }
/*# sourceMappingURL=chrome://mochitests/content/browser/devtools/client/styleeditor/test/sourcemap-css/sourcemaps.css.map */

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

@ -3,6 +3,8 @@ Getting Set Up To Work On The Firefox Codebase
This page will help you get set up to build Firefox on your own machine.
Don't hesitate to look at the :ref:`Firefox Contributors Quick Reference <Firefox Contributors' Quick Reference>` to read a quick tutorial.
.. toctree::
:caption: Thank you for contributing to Firefox

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

@ -31,6 +31,7 @@
#include "js/CompileOptions.h"
#include "js/friend/PerformanceHint.h"
#include "js/Id.h"
#include "js/loader/LoadedScript.h"
#include "js/PropertyAndElement.h" // JS_DefineProperty, JS_GetProperty
#include "js/PropertyDescriptor.h"
#include "js/RealmOptions.h"
@ -135,7 +136,6 @@
#include "mozilla/dom/IntlUtils.h"
#include "mozilla/dom/JSExecutionContext.h"
#include "mozilla/dom/LSObject.h"
#include "mozilla/dom/LoadedScript.h"
#include "mozilla/dom/LocalStorage.h"
#include "mozilla/dom/LocalStorageCommon.h"
#include "mozilla/dom/Location.h"
@ -6126,7 +6126,7 @@ class WindowScriptTimeoutHandler final : public ScriptTimeoutHandler {
virtual ~WindowScriptTimeoutHandler() = default;
// Initiating script for use when evaluating mExpr on the main thread.
RefPtr<LoadedScript> mInitiatingScript;
RefPtr<JS::loader::LoadedScript> mInitiatingScript;
};
NS_IMPL_CYCLE_COLLECTION_INHERITED(WindowScriptTimeoutHandler,

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

@ -7,6 +7,7 @@
// Microsoft's API Name hackery sucks
#undef CreateEvent
#include "js/loader/LoadedScript.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/DOMEventTargetHelper.h"
@ -25,7 +26,6 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/LoadedScript.h"
#include "mozilla/dom/PopupBlocker.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ScriptSettings.h"
@ -1234,11 +1234,13 @@ nsresult EventListenerManager::CompileEventHandlerInternal(
return NS_ERROR_FAILURE;
}
RefPtr<ScriptFetchOptions> fetchOptions = new ScriptFetchOptions(
CORS_NONE, aElement->OwnerDoc()->GetReferrerPolicy(), aElement,
aElement->OwnerDoc()->NodePrincipal(), nullptr);
RefPtr<JS::loader::ScriptFetchOptions> fetchOptions =
new JS::loader::ScriptFetchOptions(
CORS_NONE, aElement->OwnerDoc()->GetReferrerPolicy(),
aElement->OwnerDoc()->NodePrincipal());
RefPtr<EventScript> eventScript = new EventScript(fetchOptions, uri);
RefPtr<JS::loader::EventScript> eventScript =
new JS::loader::EventScript(fetchOptions, uri, aElement);
JS::CompileOptions options(cx);
// Use line 0 to make the function body starts from line 1.

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

@ -63,8 +63,8 @@ void MouseEvent::InitMouseEvent(const nsAString& aType, bool aCanBubble,
mouseEventBase->mButton = aButton;
mouseEventBase->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey,
aMetaKey);
mClientPoint.x = aClientX;
mClientPoint.y = aClientY;
mDefaultClientPoint.x = aClientX;
mDefaultClientPoint.y = aClientY;
mouseEventBase->mRefPoint.x = aScreenX;
mouseEventBase->mRefPoint.y = aScreenY;
@ -223,123 +223,77 @@ void MouseEvent::GetRegion(nsAString& aRegion) {
}
}
int32_t MouseEvent::ScreenX(CallerType aCallerType) {
CSSIntPoint MouseEvent::ScreenPoint(CallerType aCallerType) const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
return {};
}
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
// Sanitize to something sort of like client cooords, but not quite
// (defaulting to (0,0) instead of our pre-specified client coords).
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
CSSIntPoint(0, 0))
.x;
CSSIntPoint(0, 0));
}
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).x;
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint);
}
int32_t MouseEvent::ScreenY(CallerType aCallerType) {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
LayoutDeviceIntPoint MouseEvent::ScreenPointLayoutDevicePix() const {
const CSSIntPoint point = ScreenPoint(CallerType::System);
auto scale = mPresContext ? mPresContext->CSSToDevPixelScale()
: CSSToLayoutDeviceScale();
return LayoutDeviceIntPoint::Round(point * scale);
}
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
// Sanitize to something sort of like client cooords, but not quite
// (defaulting to (0,0) instead of our pre-specified client coords).
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
CSSIntPoint(0, 0))
.y;
}
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).y;
DesktopIntPoint MouseEvent::ScreenPointDesktopPix() const {
const CSSIntPoint point = ScreenPoint(CallerType::System);
auto scale =
mPresContext
? mPresContext->CSSToDevPixelScale() /
mPresContext->DeviceContext()->GetDesktopToDeviceScale()
: CSSToDesktopScale();
return DesktopIntPoint::Round(point * scale);
}
already_AddRefed<nsIScreen> MouseEvent::GetScreen() {
if (mEvent->mFlags.mIsPositionless) {
return nullptr;
}
if (!mPresContext) {
return nullptr;
}
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1");
if (!screenMgr) {
return nullptr;
}
const CSSIntPoint point =
Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint);
DesktopPoint desktopPoint =
point * mPresContext->CSSToDevPixelScale() /
mPresContext->DeviceContext()->GetDesktopToDeviceScale();
return screenMgr->ScreenForRect(DesktopIntRect(
DesktopIntPoint::Round(desktopPoint), DesktopIntSize(1, 1)));
return screenMgr->ScreenForRect(
DesktopIntRect(ScreenPointDesktopPix(), DesktopIntSize(1, 1)));
}
int32_t MouseEvent::PageX() const {
CSSIntPoint MouseEvent::PagePoint() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
return {};
}
if (mPrivateDataDuplicated) {
return mPagePoint.x;
return mPagePoint;
}
return Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.x;
mDefaultClientPoint);
}
int32_t MouseEvent::PageY() const {
CSSIntPoint MouseEvent::ClientPoint() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
if (mPrivateDataDuplicated) {
return mPagePoint.y;
}
return Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.y;
}
int32_t MouseEvent::ClientX() {
if (mEvent->mFlags.mIsPositionless) {
return 0;
return {};
}
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.x;
mDefaultClientPoint);
}
int32_t MouseEvent::ClientY() {
CSSIntPoint MouseEvent::OffsetPoint() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
return {};
}
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.y;
}
int32_t MouseEvent::OffsetX() {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.x;
}
int32_t MouseEvent::OffsetY() {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.y;
mDefaultClientPoint);
}
bool MouseEvent::AltKey() { return mEvent->AsInputEvent()->IsAlt(); }

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

@ -12,8 +12,7 @@
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventForwards.h"
namespace mozilla {
namespace dom {
namespace mozilla::dom {
class MouseEvent : public UIEvent {
public:
@ -34,15 +33,31 @@ class MouseEvent : public UIEvent {
return Button() + 1;
}
int32_t ScreenX(CallerType aCallerType);
int32_t ScreenY(CallerType aCallerType);
already_AddRefed<nsIScreen> GetScreen();
int32_t PageX() const;
int32_t PageY() const;
int32_t ClientX();
int32_t ClientY();
int32_t OffsetX();
int32_t OffsetY();
// In CSS coords.
CSSIntPoint ScreenPoint(CallerType) const;
int32_t ScreenX(CallerType aCallerType) const {
return ScreenPoint(aCallerType).x;
}
int32_t ScreenY(CallerType aCallerType) const {
return ScreenPoint(aCallerType).y;
}
LayoutDeviceIntPoint ScreenPointLayoutDevicePix() const;
DesktopIntPoint ScreenPointDesktopPix() const;
CSSIntPoint PagePoint() const;
int32_t PageX() const { return PagePoint().x; }
int32_t PageY() const { return PagePoint().y; }
CSSIntPoint ClientPoint() const;
int32_t ClientX() const { return ClientPoint().x; }
int32_t ClientY() const { return ClientPoint().y; }
CSSIntPoint OffsetPoint() const;
int32_t OffsetX() const { return OffsetPoint().x; }
int32_t OffsetY() const { return OffsetPoint().y; }
bool CtrlKey();
bool ShiftKey();
bool AltKey();
@ -91,8 +106,7 @@ class MouseEvent : public UIEvent {
const nsAString& aModifiersList);
};
} // namespace dom
} // namespace mozilla
} // namespace mozilla::dom
already_AddRefed<mozilla::dom::MouseEvent> NS_NewDOMMouseEvent(
mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,

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

@ -29,7 +29,7 @@ UIEvent::UIEvent(EventTarget* aOwner, nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, eVoidEvent, nullptr)),
mClientPoint(0, 0),
mDefaultClientPoint(0, 0),
mLayerPoint(0, 0),
mPagePoint(0, 0),
mMovementPoint(0, 0),
@ -189,12 +189,12 @@ nsIntPoint UIEvent::GetLayerPoint() const {
}
void UIEvent::DuplicatePrivateData() {
mClientPoint = Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint);
mDefaultClientPoint = Event::GetClientCoords(
mPresContext, mEvent, mEvent->mRefPoint, mDefaultClientPoint);
mMovementPoint = GetMovementPoint();
mLayerPoint = GetLayerPoint();
mPagePoint = Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint);
mDefaultClientPoint);
// GetScreenPoint converts mEvent->mRefPoint to right coordinates.
CSSIntPoint screenPoint =
Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint);

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

@ -102,7 +102,7 @@ class UIEvent : public Event {
nsCOMPtr<nsPIDOMWindowOuter> mView;
int32_t mDetail;
CSSIntPoint mClientPoint;
CSSIntPoint mDefaultClientPoint;
// Screenpoint is mEvent->mRefPoint.
nsIntPoint mLayerPoint;
CSSIntPoint mPagePoint;

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

@ -624,7 +624,7 @@ class ResolveFetchPromise : public Runnable {
mPromise(aPromise),
mResponse(aResponse) {}
NS_IMETHOD Run() {
NS_IMETHOD Run() override {
mPromise->MaybeResolve(mResponse);
return NS_OK;
}

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

@ -41,7 +41,7 @@ class GraphRunner final : public Runnable {
/**
* Runs mGraph until it shuts down.
*/
NS_IMETHOD Run();
NS_IMETHOD Run() override;
/**
* Returns true if called on mThread.

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

@ -26,7 +26,7 @@ class ProcessMessagesRunnable : public mozilla::Runnable {
explicit ProcessMessagesRunnable(const nsAString& aPortID)
: Runnable("ProcessMessagesRunnable"), mPortID(aPortID) {}
~ProcessMessagesRunnable() = default;
NS_IMETHOD Run() {
NS_IMETHOD Run() override {
// If service is no longer running, just exist without processing.
if (!MIDIPlatformService::IsRunning()) {
return NS_OK;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше