зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438508 - Allows running brower_browser_toolbox_debugger.js more than once. r=jryans
The sandbox used in this test isn't immediately destroyed when the test finishes. So use a unique file name to always refer to the expected sandbox/file in this debugger test. MozReview-Commit-ID: FJYXPN0RQS2 --HG-- extra : rebase_source : 438ae8cf97bfef8bc11e86e7850b3d6d8e8f1ccc
This commit is contained in:
Родитель
0b75d2333d
Коммит
8e71d2a2f3
|
@ -32,10 +32,17 @@ add_task(function* runTest() {
|
||||||
});
|
});
|
||||||
|
|
||||||
let s = Cu.Sandbox("http://mozilla.org");
|
let s = Cu.Sandbox("http://mozilla.org");
|
||||||
|
|
||||||
|
// Use a unique id for the fake script name in order to be able to run
|
||||||
|
// this test more than once. That's because the Sandbox is not immediately
|
||||||
|
// destroyed and so the debugger would display only one file but not necessarily
|
||||||
|
// connected to the latest sandbox.
|
||||||
|
let id = new Date().getTime();
|
||||||
|
|
||||||
// Pass a fake URL to evalInSandbox. If we just pass a filename,
|
// Pass a fake URL to evalInSandbox. If we just pass a filename,
|
||||||
// Debugger is going to fail and only display root folder (`/`) listing.
|
// Debugger is going to fail and only display root folder (`/`) listing.
|
||||||
// But it won't try to fetch this url and use sandbox content as expected.
|
// But it won't try to fetch this url and use sandbox content as expected.
|
||||||
let testUrl = "http://mozilla.org/browser-toolbox-test.js";
|
let testUrl = `http://mozilla.org/browser-toolbox-test-${id}.js`;
|
||||||
Cu.evalInSandbox("(" + function () {
|
Cu.evalInSandbox("(" + function () {
|
||||||
this.plop = function plop() {
|
this.plop = function plop() {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -117,7 +124,7 @@ add_task(function* runTest() {
|
||||||
// toolbox process
|
// toolbox process
|
||||||
let testScript = (yield fetch(testScriptURL)).content;
|
let testScript = (yield fetch(testScriptURL)).content;
|
||||||
let source =
|
let source =
|
||||||
"try {" + testHead + debuggerHead + testScript + "} catch (e) {" +
|
"try { let testUrl = \""+testUrl+"\";" + testHead + debuggerHead + testScript + "} catch (e) {" +
|
||||||
" dump('Exception: '+ e + ' at ' + e.fileName + ':' + " +
|
" dump('Exception: '+ e + ' at ' + e.fileName + ':' + " +
|
||||||
" e.lineNumber + '\\nStack: ' + e.stack + '\\n');" +
|
" e.lineNumber + '\\nStack: ' + e.stack + '\\n');" +
|
||||||
"}";
|
"}";
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
info(`START: ${new Error().lineNumber}`);
|
info(`START: ${new Error().lineNumber}`);
|
||||||
|
|
||||||
let testUrl = "http://mozilla.org/browser-toolbox-test.js";
|
|
||||||
|
|
||||||
Task.spawn(function* () {
|
Task.spawn(function* () {
|
||||||
Services.prefs.clearUserPref("devtools.debugger.tabs")
|
Services.prefs.clearUserPref("devtools.debugger.tabs")
|
||||||
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location")
|
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location")
|
||||||
|
@ -24,26 +22,29 @@ Task.spawn(function* () {
|
||||||
});
|
});
|
||||||
let arrow = domain.querySelector(".arrow");
|
let arrow = domain.querySelector(".arrow");
|
||||||
arrow.click();
|
arrow.click();
|
||||||
|
|
||||||
|
let fileName = testUrl.match(/browser-toolbox-test.*\.js/)[0];
|
||||||
|
|
||||||
let script = [...document.querySelectorAll(".tree-node")].find(node => {
|
let script = [...document.querySelectorAll(".tree-node")].find(node => {
|
||||||
return node.textContent.includes("browser-toolbox-test.js");
|
return node.textContent.includes(fileName);
|
||||||
});
|
});
|
||||||
script = script.querySelector(".node");
|
script = script.querySelector(".node");
|
||||||
script.click();
|
script.click();
|
||||||
|
|
||||||
let onPaused = waitForPaused(dbg);
|
let onPaused = waitForPaused(dbg);
|
||||||
yield addBreakpoint(dbg, "browser-toolbox-test.js", 2);
|
yield addBreakpoint(dbg, fileName, 2);
|
||||||
|
|
||||||
yield onPaused;
|
yield onPaused;
|
||||||
|
|
||||||
assertPausedLocation(dbg, "browser-toolbox-test.js", 2);
|
assertPausedLocation(dbg, fileName, 2);
|
||||||
|
|
||||||
yield stepIn(dbg);
|
yield stepIn(dbg);
|
||||||
|
|
||||||
assertPausedLocation(dbg, "browser-toolbox-test.js", 3);
|
assertPausedLocation(dbg, fileName, 3);
|
||||||
|
|
||||||
// Remove the breakpoint before resuming in order to prevent hitting the breakpoint
|
// Remove the breakpoint before resuming in order to prevent hitting the breakpoint
|
||||||
// again during test closing.
|
// again during test closing.
|
||||||
let source = findSource(dbg, "browser-toolbox-test.js");
|
let source = findSource(dbg, fileName);
|
||||||
yield removeBreakpoint(dbg, source.id, 2);
|
yield removeBreakpoint(dbg, source.id, 2);
|
||||||
|
|
||||||
yield resume(dbg);
|
yield resume(dbg);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче