Bug 1276073 - Ensure source is loaded and selected before running debugger tests. r=jlongster

This commit is contained in:
Alexandre Poirot 2016-06-02 01:44:05 -07:00
parent aeb8cb76b8
commit 33bf4b8832
75 changed files with 123 additions and 112 deletions

View File

@ -17,7 +17,7 @@ function test() {
requestLongerTimeout(2);
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -10,14 +10,14 @@ const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html";
var gTab, gPanel, gDebugger;
var gEditor, gSources, gPrefs, gOptions, gView;
var gFirstSourceLabel = "code_ugly-5.js";
var gSecondSourceLabel = "code_ugly-6.js";
var gFirstSource = EXAMPLE_URL + "code_ugly-5.js";
var gSecondSource = EXAMPLE_URL + "code_ugly-6.js";
var gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print");
function test() {
let options = {
source: gFirstSourceLabel,
source: gFirstSource,
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
@ -37,9 +37,9 @@ function test() {
testAutoPrettyPrintOn();
reload(gPanel);
yield waitForSourceShown(gPanel, gFirstSourceLabel);
yield waitForSourceShown(gPanel, gFirstSource);
testSourceIsUgly();
yield waitForSourceShown(gPanel, gFirstSourceLabel);
yield waitForSourceShown(gPanel, gFirstSource);
testSourceIsPretty();
disableAutoPrettyPrint();
testAutoPrettyPrintOff();
@ -64,7 +64,7 @@ function testSourceIsUgly() {
function testSecondSourceLabel() {
let source = gSources.selectedItem.attachment.source;
ok(source.url === EXAMPLE_URL + gSecondSourceLabel,
ok(source.url === gSecondSource,
"Second source url is correct.");
}

View File

@ -14,15 +14,15 @@ const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-02.html";
var gTab, gDebuggee, gPanel, gDebugger;
var gEditor, gSources, gPrefs, gOptions, gView;
var gFirstSourceLabel = "code_ugly-6.js";
var gSecondSourceLabel = "code_ugly-7.js";
var gFirstSource = EXAMPLE_URL + "code_ugly-6.js";
var gSecondSource = EXAMPLE_URL + "code_ugly-7.js";
var gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print");
Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", true);
function test() {
let options = {
source: gFirstSourceLabel,
source: gFirstSource,
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {
@ -43,7 +43,7 @@ function test() {
testSourceIsUgly();
yield waitForSourceShown(gPanel, gFirstSourceLabel);
yield waitForSourceShown(gPanel, gFirstSource);
testSourceIsPretty();
testPrettyPrintButtonOn();
@ -84,13 +84,13 @@ function test() {
function testFirstSourceLabel() {
let source = gSources.selectedItem.attachment.source;
ok(source.url === EXAMPLE_URL + gFirstSourceLabel,
ok(source.url === gFirstSource,
"First source url is correct.");
}
function testSecondSourceLabel() {
let source = gSources.selectedItem.attachment.source;
ok(source.url === EXAMPLE_URL + gSecondSourceLabel,
ok(source.url === gSecondSource,
"Second source url is correct.");
}

View File

@ -11,8 +11,8 @@
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-02.html";
var FIRST_SOURCE = "code_ugly-6.js";
var SECOND_SOURCE = "code_ugly-7.js";
var FIRST_SOURCE = EXAMPLE_URL + "code_ugly-6.js";
var SECOND_SOURCE = EXAMPLE_URL + "code_ugly-7.js";
function test() {
let options = {
@ -31,7 +31,7 @@ function test() {
const actions = bindActionCreators(gPanel);
Task.spawn(function* () {
const secondSource = queries.getSourceByURL(gController.getState(), EXAMPLE_URL + SECOND_SOURCE);
const secondSource = queries.getSourceByURL(gController.getState(), SECOND_SOURCE);
actions.selectSource(secondSource);
// It should be showing the loading text

View File

@ -18,7 +18,7 @@ const test = Task.async(function* () {
info("Starting browser_dbg_bfcache.js's `test`.");
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
([gTab, gDebuggee, gPanel]) = yield initDebugger(TAB_URL_1, options);

View File

@ -13,7 +13,7 @@ var gTab, gPanel, gDebugger;
function test() {
let options = {
source: ".coffee",
source: EXAMPLE_URL + "code_binary_search.coffee",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gDeck;
function test() {
let options = {
source: ".coffee",
source: EXAMPLE_URL + "code_binary_search.coffee",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gSources;
function test() {
let options = {
source: "code_blackboxing_blackboxme.js",
source: EXAMPLE_URL + "code_blackboxing_blackboxme.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ var gTab, gPanel, gDebugger;
function test() {
let options = {
source: ".min.js"
source: EXAMPLE_URL + "code_blackboxing_unblackbox.min.js",
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
gTab = aTab;

View File

@ -14,7 +14,7 @@ function test() {
let gSources, gFrames;
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
function test() {
const options = {
source: "-eval.js",
source: EXAMPLE_URL + "code_script-eval.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ function test() {
let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
let options = {
source: "-eval.js",
source: EXAMPLE_URL + "code_script-eval.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ function test() {
let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
const options = {
source: "-eval.js",
source: EXAMPLE_URL + "code_script-eval.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ function test() {
Task.spawn(function* () {
const options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
const [gTab,, gPanel ] = yield initDebugger(TAB_URL, options);

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
function test() {
let options = {
source: "-eval.js",
source: EXAMPLE_URL + "code_script-eval.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_breakpoints-other-tabs.html";
var test = Task.async(function* () {
const options = {
source: "code_breakpoints-other-tabs.js",
source: EXAMPLE_URL + "code_breakpoints-other-tabs.js",
line: 1
};
const [tab1,, panel1] = yield initDebugger(TAB_URL, options);

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -8,7 +8,7 @@
*/
const TAB_URL = EXAMPLE_URL + "doc_bug-896139.html";
const SCRIPT_URL = "code_bug-896139.js";
const SCRIPT_URL = EXAMPLE_URL + "code_bug-896139.js";
function test() {
Task.spawn(function* () {
@ -18,36 +18,17 @@ function test() {
return promise.then(() => doResume(panel));
}
let [tab,, panel] = yield initDebugger();
let options = {
source: SCRIPT_URL,
line: 1
};
let [tab,, panel] = yield initDebugger(TAB_URL, options);
let win = panel.panelWin;
let Sources = win.DebuggerView.Sources;
// Load the debugger against a blank document and load the test url only
// here and not via initDebugger. That, because this test load SCRIPT_URL
// dynamically, on load, and the debugger may be on TAB_URL or SCRIPT_URL
// depending on cpu speed. initDebugger expect to assert one precise
// source.
yield navigateActiveTabTo(panel,
TAB_URL,
win.EVENTS.SOURCE_SHOWN);
if (Sources.selectedItem.attachment.source.url.indexOf(SCRIPT_URL) === -1) {
// If there is only the html file, wait for the js file to be listed.
if (Sources.itemCount == 1) {
yield waitForDebuggerEvents(panel, win.EVENTS.NEW_SOURCE);
// Wait for it to be added to the UI
yield waitForTick();
}
// Select the js file.
let onSource = waitForSourceAndCaret(panel, SCRIPT_URL, 1);
Sources.selectedValue = getSourceActor(win.DebuggerView.Sources,
EXAMPLE_URL + SCRIPT_URL);
yield onSource;
}
yield panel.addBreakpoint({
actor: getSourceActor(win.DebuggerView.Sources, EXAMPLE_URL + SCRIPT_URL),
actor: getSourceActor(win.DebuggerView.Sources, SCRIPT_URL),
line: 6
});

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
Task.spawn(function* () {
const options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
const [tab,, panel] = yield initDebugger(TAB_URL, options);

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
Task.spawn(function* () {
const options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
const [tab,, panel] = yield initDebugger(TAB_URL, options);

View File

@ -14,7 +14,7 @@ function test() {
let gEditor, gSources, gContextMenu;
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources;
function test() {
let options = {
source: "code_script-switching-01.js?a=b",
source: EXAMPLE_URL + "code_script-switching-01.js?a=b",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -17,7 +17,7 @@ function test() {
RootActor.prototype.traits.noPrettyPrinting = true;
let options = {
source: "code_ugly-5.js",
source: EXAMPLE_URL + "code_ugly-5.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {

View File

@ -14,7 +14,7 @@ function test() {
let gIframe, gEditor, gSources, gFrames;
let options = {
source: "inline-debugger-statement.html",
source: EXAMPLE_URL + "doc_inline-debugger-statement.html",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {

View File

@ -14,7 +14,7 @@ function test() {
let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ function test() {
let gTab, gPanel, gDebugger, gSources;
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_function-jump-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly.js",
source: EXAMPLE_URL + "code_ugly.js",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -13,7 +13,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly.js",
source: EXAMPLE_URL + "code_ugly.js",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly.js",
source: EXAMPLE_URL + "code_ugly.js",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly.js",
source: EXAMPLE_URL + "code_ugly.js",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
function test() {
let options = {
source: "code_ugly-2.js",
source: EXAMPLE_URL + "code_ugly-2.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
function test() {
let options = {
source: "code_ugly-2.js",
source: EXAMPLE_URL + "code_ugly-2.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
function test() {
let options = {
source: "code_ugly-2.js",
source: EXAMPLE_URL + "code_ugly-2.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -13,7 +13,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly.js",
source: EXAMPLE_URL + "code_ugly.js",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources;
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly.js",
source: EXAMPLE_URL + "code_ugly.js",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print-3.html";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_ugly-8",
source: EXAMPLE_URL + "code_ugly-8",
line: 2
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -17,7 +17,7 @@ const SECOND_SOURCE_VALUE = EXAMPLE_URL + "code_ugly-2.js";
function test() {
// Wait for debugger panel to be fully set and break on debugger statement
let options = {
source: "code_script-switching-02.js",
source: EXAMPLE_URL + "code_script-switching-02.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -16,7 +16,7 @@ var gSources;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gParams = "?foo=bar,baz|lol";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -11,7 +11,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -13,7 +13,7 @@ function test() {
const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
let options = {
source: "code_function-search-01.js",
source: EXAMPLE_URL + "code_function-search-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ var gSources, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1,
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -13,7 +13,7 @@ var gSources, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1,
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1,
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gSearchView, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gSearchView, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gSearchView, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gSearchView, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -16,7 +16,7 @@ var gEditor, gSources, gSearchView, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gSearchView, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ var gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js?a=b",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ function test() {
requestLongerTimeout(3);
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -17,7 +17,7 @@ function test() {
requestLongerTimeout(3);
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js?a=b",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ var gSources, gSearchBox;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js?a=b",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -14,7 +14,7 @@ var gEditor, gSources, gSearchBox, gFilteredFunctions;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_function-search-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gSearchBox, gSearchBoxPanel;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSearchBox, gSearchBoxPanel;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gSources, gFrames, gPrefs, gOptions;
function test() {
let options = {
source: ".coffee",
source: EXAMPLE_URL + "code_binary_search.coffee",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -12,7 +12,7 @@ const TOTAL_SOURCES = 4;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_function-search-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {

View File

@ -14,7 +14,7 @@ function test() {
let gSources, gBreakpoints;
let options = {
source: "-eval.js",
source: EXAMPLE_URL + "code_script-eval.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ function test() {
let gSources, gBreakpoints, gEditor;
let options = {
source: "-eval.js",
source: EXAMPLE_URL + "code_script-eval.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -13,7 +13,7 @@ const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_function-search-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {

View File

@ -9,6 +9,8 @@
const TAB_URL = EXAMPLE_URL + "doc_script_webext_contentscript.html";
let {getExtensionUUID} = Cu.import("resource://gre/modules/Extension.jsm", {});
function test() {
let gPanel, gDebugger;
let gSources, gAddon;
@ -29,9 +31,10 @@ function test() {
return Task.spawn(function* () {
gAddon = yield addAddon(EXAMPLE_URL + "/addon-webext-contentscript.xpi");
let uuid = getExtensionUUID(gAddon.id);
let options = {
source: "webext-content-script.js",
source: `moz-extension://${uuid}/webext-content-script.js`,
line: 1
};
[,, gPanel] = yield initDebugger(TAB_URL, options);

View File

@ -12,7 +12,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -15,7 +15,7 @@ var gEditor, gSources, gFrames, gClassicFrames;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -16,7 +16,7 @@ var gEditor, gSources, gFrames, gClassicFrames, gToolbar;
function test() {
let options = {
source: "-01.js",
source: EXAMPLE_URL + "code_script-switching-01.js",
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {

View File

@ -238,6 +238,24 @@ function waitForTime(aDelay) {
return deferred.promise;
}
function waitForSourceLoaded(aPanel, aUrl) {
let { Sources } = aPanel.panelWin.DebuggerView;
let isLoaded = Sources.items.some(item =>
item.attachment.source.url === aUrl);
if (isLoaded) {
info("The correct source has been loaded.");
return promise.resolve(null);
} else {
return waitForDebuggerEvents(aPanel, aPanel.panelWin.EVENTS.NEW_SOURCE).then(() => {
// Wait for it to be loaded in the UI and appear into Sources.items.
return waitForTick();
}).then(() => {
return waitForSourceLoaded(aPanel, aUrl);
});
}
}
function waitForSourceShown(aPanel, aUrl) {
return waitForDebuggerEvents(aPanel, aPanel.panelWin.EVENTS.SOURCE_SHOWN).then(aSource => {
let sourceUrl = aSource.url || aSource.introductionUrl;
@ -559,6 +577,7 @@ let initDebugger = Task.async(function*(urlOrTab, options) {
let debuggerPanel = toolbox.getCurrentPanel();
let panelWin = debuggerPanel.panelWin;
let { Sources } = panelWin.DebuggerView;
prepareDebugger(debuggerPanel);
@ -577,7 +596,15 @@ let initDebugger = Task.async(function*(urlOrTab, options) {
panelWin.EVENTS.SOURCE_SHOWN);
}
if (source) {
ensureSourceIs(debuggerPanel, source);
let isSelected = Sources.selectedItem.attachment.source.url === source;
if (!isSelected) {
// Ensure that the source is loaded first before trying to select it
yield waitForSourceLoaded(debuggerPanel, source);
// Select the js file.
let onSource = waitForSourceAndCaret(debuggerPanel, source, line ? line : 1);
Sources.selectedValue = getSourceActor(Sources, source);
yield onSource;
}
}
yield onCaretUpdated;
}