author | Alexandre Poirot <poirot.alex@gmail.com> |
Thu, 26 May 2016 09:12:17 -0700 | |
changeset 299109 | 1af204777b4ddb868882d972663a13cbb324ea0b |
parent 299108 | 5fdfce654062b471415a82f1a2c07200fc463dcf |
child 299110 | 73912a342d3731b8e292229fa940b623a8719d7b |
push id | 30290 |
push user | ryanvm@gmail.com |
push date | Fri, 27 May 2016 01:44:20 +0000 |
treeherder | mozilla-central@34ac60e5b29c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | fitzgen |
bugs | 1080025 |
milestone | 49.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/client/debugger/test/mochitest/browser.ini +++ b/devtools/client/debugger/test/mochitest/browser.ini @@ -391,18 +391,16 @@ skip-if = e10s && debug [browser_dbg_promises-allocation-stack.js] skip-if = e10s && debug [browser_dbg_promises-chrome-allocation-stack.js] skip-if = true # Bug 1177730 [browser_dbg_promises-fulfillment-stack.js] skip-if = e10s && debug [browser_dbg_promises-rejection-stack.js] skip-if = e10s && debug -[browser_dbg_reload-preferred-script-01.js] -skip-if = e10s && debug [browser_dbg_reload-preferred-script-02.js] skip-if = e10s && debug [browser_dbg_reload-preferred-script-03.js] skip-if = e10s && debug [browser_dbg_reload-same-script.js] skip-if = e10s && debug [browser_dbg_scripts-switching-01.js] skip-if = e10s && debug
--- a/devtools/client/debugger/test/mochitest/browser_dbg_aaa_run_first_leaktest.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_aaa_run_first_leaktest.js @@ -11,17 +11,21 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { // Wait longer for this very simple test that comes first, to make sure that // GC from previous tests does not interfere with the debugger suite. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { ok(aTab, "Should have a tab available."); ok(aPanel, "Should have a debugger pane available."); waitForSourceAndCaretAndScopes(aPanel, "-02.js", 1).then(() => { resumeDebuggerThenCloseAndFinish(aPanel); }); callInTab(aTab, "firstCall");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-01.js @@ -11,28 +11,31 @@ var gTab, gPanel, gDebugger; var gEditor, gSources, gPrefs, gOptions, gView; var gFirstSourceLabel = "code_ugly-5.js"; var gSecondSourceLabel = "code_ugly-6.js"; var gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print"); function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: gFirstSourceLabel, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; gView = gDebugger.DebuggerView; Task.spawn(function* () { - yield waitForSourceShown(gPanel, gFirstSourceLabel); testSourceIsUgly(); enableAutoPrettyPrint(); testAutoPrettyPrintOn(); reload(gPanel); yield waitForSourceShown(gPanel, gFirstSourceLabel); testSourceIsUgly();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-02.js @@ -16,33 +16,36 @@ var gEditor, gSources, gPrefs, gOptions, var gFirstSourceLabel = "code_ugly-6.js"; var gSecondSourceLabel = "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() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: gFirstSourceLabel, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { const gTab = aTab; const gDebuggee = aDebuggee; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gPrefs = gDebugger.Prefs; const gOptions = gDebugger.DebuggerView.Options; const gView = gDebugger.DebuggerView; // Should be on by default. testAutoPrettyPrintOn(); Task.spawn(function* () { - yield waitForSourceShown(gPanel, gFirstSourceLabel); testSourceIsUgly(); yield waitForSourceShown(gPanel, gFirstSourceLabel); testSourceIsPretty(); testPrettyPrintButtonOn(); // select second source yield selectSecondSource();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-03.js @@ -10,30 +10,32 @@ */ 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"; function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: FIRST_SOURCE, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gController = gDebugger.DebuggerController; const gEditor = gDebugger.DebuggerView.editor; const constants = gDebugger.require("./content/constants"); const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); Task.spawn(function* () { - yield waitForSourceShown(gPanel, FIRST_SOURCE); - const secondSource = queries.getSourceByURL(gController.getState(), EXAMPLE_URL + SECOND_SOURCE); actions.selectSource(secondSource); // It should be showing the loading text is(gEditor.getText(), gDebugger.DebuggerView._loadingText, "The editor loading text is shown"); gController.dispatch({
--- a/devtools/client/debugger/test/mochitest/browser_dbg_bfcache.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_bfcache.js @@ -12,17 +12,21 @@ const TAB_URL_1 = EXAMPLE_URL + "doc_scr const TAB_URL_2 = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gDebuggee, gPanel, gDebugger; var gSources; const test = Task.async(function* () { info("Starting browser_dbg_bfcache.js's `test`."); - ([gTab, gDebuggee, gPanel]) = yield initDebugger(TAB_URL_1); + let options = { + source: "-01.js", + line: 1 + }; + ([gTab, gDebuggee, gPanel]) = yield initDebugger(TAB_URL_1, options); gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; yield testFirstPage(); yield testLocationChange(); yield testBack(); yield testForward(); return closeDebuggerAndFinish(gPanel);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-01.js @@ -7,23 +7,26 @@ * Test that if we black box a source and then refresh, it is still black boxed. */ const TAB_URL = EXAMPLE_URL + "doc_binary_search.html"; var gTab, gPanel, gDebugger; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: ".coffee", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; - waitForSourceShown(gPanel, ".coffee") - .then(testBlackBoxSource) + testBlackBoxSource() .then(testBlackBoxReload) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-02.js @@ -10,24 +10,27 @@ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"; var gTab, gPanel, gDebugger; var gFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: BLACKBOXME_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; - waitForSourceShown(gPanel, BLACKBOXME_URL) - .then(testBlackBoxSource) + testBlackBoxSource() .then(testBlackBoxStack) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-03.js @@ -10,17 +10,21 @@ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"; var gTab, gPanel, gDebugger; var gFrames, gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: BLACKBOXME_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gSources = gDebugger.DebuggerView.Sources; waitForSourceAndCaretAndScopes(gPanel, ".html", 21) .then(testBlackBoxStack)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-04.js @@ -10,25 +10,28 @@ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"; var gTab, gPanel, gDebugger; var gFrames, gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: BLACKBOXME_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, BLACKBOXME_URL) - .then(blackBoxSources) + blackBoxSources() .then(testBlackBoxStack) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-05.js @@ -9,25 +9,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_binary_search.html"; var gTab, gPanel, gDebugger; var gDeck; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: ".coffee", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gDeck = gDebugger.document.getElementById("editor-deck"); - waitForSourceShown(gPanel, ".coffee") - .then(testSourceEditorShown) - .then(toggleBlackBoxing.bind(null, gPanel)) + testSourceEditorShown(); + toggleBlackBoxing(gPanel) .then(testBlackBoxMessageShown) .then(clickStopBlackBoxingButton) .then(testSourceEditorShownAgain) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-06.js @@ -9,23 +9,27 @@ */ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; var gTab, gPanel, gDebugger; var gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "code_blackboxing_blackboxme.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - waitForSourceAndCaretAndScopes(gPanel, ".html", 21) + waitForCaretAndScopes(gPanel, 21) .then(testBlackBox) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); callInTab(gTab, "runTest"); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-07.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_blackboxing-07.js @@ -8,23 +8,25 @@ * and then refresh, it is still unblackboxed. */ const TAB_URL = EXAMPLE_URL + "doc_blackboxing_unblackbox.html"; var gTab, gPanel, gDebugger; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: ".min.js" + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; - waitForSourceShown(gPanel, ".min.js") - .then(testBlackBoxSource) + testBlackBoxSource() .then(testBlackBoxReload) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breadcrumbs-access.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breadcrumbs-access.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gFrames; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6) .then(checkNavigationWhileNotFocused)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-in-anon.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-in-anon.js @@ -6,24 +6,27 @@ /** * Make sure anonymous eval scripts can still break with a `debugger` * statement */ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + const options = { + source: "-eval.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; return Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-eval.js"); is(gSources.values.length, 1, "Should have 1 source"); callInTab(gTab, "evalSourceWithDebugger"); yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN); is(gSources.values.length, 2, "Should have 2 sources"); let item = gSources.getItemForAttachment(e => e.label.indexOf("SCRIPT") === 0);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-01.js @@ -11,17 +11,21 @@ thisTestLeaksUncaughtRejectionsAndShould /** * Tests that event listeners aren't fetched when the events tab isn't selected. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gPanel = aPanel; let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gEvents = gView.EventListeners; let gController = gDebugger.DebuggerController; let constants = gDebugger.require("./content/constants"); gDebugger.on(gDebugger.EVENTS.EVENT_LISTENERS_FETCHED, () => { @@ -34,17 +38,16 @@ function test() { gView.toggleInstrumentsPane({ visible: true, animated: false }); is(gView.instrumentsPaneHidden, false, "The instruments pane should be visible now."); is(gView.instrumentsPaneTab, "variables-tab", "The variables tab should be selected by default."); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); is(gEvents.itemCount, 0, "There should be no events before reloading."); let reloaded = waitForNavigation(gPanel); gDebugger.DebuggerController._target.activeTab.reload(); is(gEvents.itemCount, 0, "There should be no events while reloading."); yield reloaded; is(gEvents.itemCount, 0, "There should be no events after reloading.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-02.js @@ -6,26 +6,29 @@ /** * Tests that event listeners are fetched when the events tab is selected * or while sources are fetched and the events tab is focused. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gPanel = aPanel; let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gEvents = gView.EventListeners; let gController = gDebugger.DebuggerController; let constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); yield testFetchOnFocus(); yield testFetchOnReloadWhenFocused(); yield testFetchOnReloadWhenNotFocused(); yield closeDebuggerAndFinish(aPanel); }); function testFetchOnFocus() { return Task.spawn(function* () {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-03.js @@ -5,26 +5,28 @@ /** * Tests that event listeners are properly displayed in the view. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gEvents = gView.EventListeners; let gController = gDebugger.DebuggerController; let constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); - let fetched = waitForDispatch(aPanel, constants.FETCH_EVENT_LISTENERS); gView.toggleInstrumentsPane({ visible: true, animated: false }, 1); yield fetched; is(gEvents.widget._parent.querySelectorAll(".side-menu-widget-group").length, 3, "There should be 3 groups shown in the view."); let groupCheckboxes = gEvents.widget._parent.querySelectorAll(
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-04.js @@ -6,26 +6,28 @@ /** * Tests that checking/unchecking an event listener in the view correctly * causes the active thread to get updated with the new event breakpoints. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gController = gDebugger.DebuggerController; let gEvents = gView.EventListeners; let constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); - let fetched = waitForDispatch(aPanel, constants.FETCH_EVENT_LISTENERS); gView.toggleInstrumentsPane({ visible: true, animated: false }, 1); yield fetched; testEventItem(0, false); testEventItem(1, false); testEventItem(2, false); testEventItem(3, false);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-05.js @@ -7,26 +7,28 @@ * Tests that checking/unchecking an event listener's group in the view will * cause the active thread to get updated with the new event breakpoints for * all children inside that group. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gController = gDebugger.DebuggerController; let gEvents = gView.EventListeners; let constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); - let fetched = waitForDispatch(aPanel, constants.FETCH_EVENT_LISTENERS); gView.toggleInstrumentsPane({ visible: true, animated: false }, 1); yield fetched; testEventItem(0, false); testEventItem(1, false); testEventItem(2, false); testEventItem(3, false);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-06.js @@ -6,27 +6,29 @@ /** * Tests that the event listener states are preserved in the view after the * target navigates. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gController = gDebugger.DebuggerController; let gEvents = gView.EventListeners; let gBreakpoints = gController.Breakpoints; let constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); - let fetched = waitForDispatch(aPanel, constants.FETCH_EVENT_LISTENERS); gView.toggleInstrumentsPane({ visible: true, animated: false }, 1); yield fetched; testEventItem(0, false); testEventItem(1, false); testEventItem(2, false); testEventItem(3, false);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-07.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-07.js @@ -3,17 +3,17 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Tests that system event listeners don't get duplicated in the view. */ function test() { - initDebugger("about:blank").then(([aTab,, aPanel]) => { + initDebugger().then(([aTab,, aPanel]) => { let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gEvents = gView.EventListeners; let gL10N = gDebugger.L10N; is(gEvents.itemCount, 0, "There are no events displayed in the corresponding pane yet.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-08.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-08.js @@ -5,26 +5,29 @@ /** * Tests that breaking on an event selects the variables view tab. */ const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gTab = aTab; let gDebugger = aPanel.panelWin; let gView = gDebugger.DebuggerView; let gEvents = gView.EventListeners; let gController = gDebugger.DebuggerController; let constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceShown(aPanel, ".html"); yield callInTab(gTab, "addBodyClickEventListener"); let fetched = waitForDispatch(aPanel, constants.FETCH_EVENT_LISTENERS); gView.toggleInstrumentsPane({ visible: true, animated: false }, 1); yield fetched; yield ensureThreadClientState(aPanel, "attached"); is(gView.instrumentsPaneHidden, false,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-next-console.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-next-console.js @@ -9,28 +9,31 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-eval.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gTarget = gDebugger.gTarget; gThreadClient = gDebugger.gThreadClient; gResumeButton = gDebugger.document.getElementById("resume"); gResumeKey = gDebugger.document.getElementById("resumeKey"); - waitForSourceShown(gPanel, "-eval.js") - .then(testConsole) + testConsole() .then(() => closeDebuggerAndFinish(gPanel)); }); let testConsole = Task.async(function* () { info("Starting testConsole"); let oncePaused = gTarget.once("thread-paused"); EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-next.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-next.js @@ -9,28 +9,31 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + const options = { + source: "-eval.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gTarget = gDebugger.gTarget; gThreadClient = gDebugger.gThreadClient; gResumeButton = gDebugger.document.getElementById("resume"); gResumeKey = gDebugger.document.getElementById("resumeKey"); - waitForSourceShown(gPanel, "-eval.js") - .then(testInterval) + testInterval() .then(testEvent) .then(() => closeDebuggerAndFinish(gPanel)); }); // Testing an interval instead of a timeout / rAF because // it's less likely to fail due to timing issues. If the // first callback happens to fire before the break request // happens then we'll just get it next time.
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-actual-location.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-actual-location.js @@ -6,17 +6,21 @@ /** * Bug 737803: Setting a breakpoint in a line without code should move * the icon to the actual location. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gController = gDebugger.DebuggerController; const constants = gDebugger.require("./content/constants"); const queries = gDebugger.require("./content/queries");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-actual-location2.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-actual-location2.js @@ -7,17 +7,21 @@ * Bug 1008372: Setting a breakpoint in a line without code should move * the icon to the actual location, and if a breakpoint already exists * on the new location don't duplicate */ const TAB_URL = EXAMPLE_URL + "doc_breakpoint-move.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gController = gDebugger.DebuggerController; const actions = bindActionCreators(gPanel); const constants = gDebugger.require("./content/constants"); @@ -35,17 +39,19 @@ function test() { function testBreakpoint(line) { let bp = gSources._selectedBreakpoint; ok(bp, "There should be a selected breakpoint on line " + line); is(bp.location.line, line, "The breakpoint on line " + line + " was not hit"); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 1); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 16); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; is(queries.getBreakpoints(gController.getState()).length, 0, "There are no breakpoints in the editor"); yield actions.addBreakpoint({ actor: gSources.selectedValue, line: 19 }); @@ -73,12 +79,10 @@ function test() { yield doResume(gPanel); callInTab(gTab, "ermahgerd"); yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES); yield resumeAndTestBreakpoint(20); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js @@ -12,17 +12,21 @@ const TAB_URL = EXAMPLE_URL + "doc_break const CODE_URL = EXAMPLE_URL + "code_breakpoints-break-on-last-line-of-script-on-reload.js"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); let gPanel, gDebugger, gThreadClient, gEvents, gSources; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + const options = { + source: CODE_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gPanel = aPanel; gDebugger = gPanel.panelWin; gThreadClient = gDebugger.gThreadClient; gEvents = gDebugger.EVENTS; gSources = gDebugger.DebuggerView.Sources; const actions = bindActionCreators(gPanel); Task.spawn(function* () {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-button-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-button-01.js @@ -5,17 +5,21 @@ /** * Test if the breakpoints toggle button works as advertised. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; function checkBreakpointsDisabled(isDisabled, total = 3) { @@ -23,18 +27,16 @@ function test() { is(breakpoints.length, total, "Breakpoints should still be set."); is(breakpoints.filter(bp => bp.disabled === isDisabled).length, total, "Breakpoints should be " + (isDisabled ? "disabled" : "enabled") + "."); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); - yield actions.addBreakpoint({ actor: gSources.values[0], line: 5 }); yield actions.addBreakpoint({ actor: gSources.values[1], line: 6 }); yield actions.addBreakpoint({ actor: gSources.values[1], line: 7 }); yield ensureThreadClientState(gPanel, "resumed"); gSources.toggleBreakpoints(); yield waitForDispatch(gPanel, gDebugger.constants.REMOVE_BREAKPOINT, 3); checkBreakpointsDisabled(true);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-button-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-button-02.js @@ -6,17 +6,21 @@ /** * Test if the breakpoints toggle button works as advertised when there are * some breakpoints already disabled. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; function checkBreakpointsDisabled(isDisabled, total = 3) { @@ -24,18 +28,16 @@ function test() { is(breakpoints.length, total, "Breakpoints should still be set."); is(breakpoints.filter(bp => bp.disabled === isDisabled).length, total, "Breakpoints should be " + (isDisabled ? "disabled" : "enabled") + "."); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); - yield promise.all([ actions.addBreakpoint({ actor: gSources.values[0], line: 5 }), actions.addBreakpoint({ actor: gSources.values[1], line: 6 }), actions.addBreakpoint({ actor: gSources.values[1], line: 7 }) ]); if (gDebugger.gThreadClient.state !== "attached") { yield waitForThreadEvents(gPanel, "resumed"); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-condition-thrown-message.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-condition-thrown-message.js @@ -6,17 +6,21 @@ /** * Make sure that the message which breakpoint condition throws * could be displayed on UI correctly */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; @@ -63,17 +67,19 @@ function test() { ); let attachment = gSources._getBreakpoint(bp).attachment; ok(!attachment.view.container.classList.contains("dbg-breakpoint-condition-thrown"), "Message on line " + line + " should be hidden if condition doesn't throw."); }); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; yield actions.addBreakpoint({ actor: gSources.selectedValue, line: 18 }, " 1afff"); // Close the popup because a SET_BREAKPOINT_CONDITION action is // fired when it's closed, and it sets it on the currently // selected breakpoint and we want to make sure it uses the // current breakpoint. This isn't a problem outside of tests // because any UI interaction will close the popup before the // new breakpoint is added. @@ -92,12 +98,10 @@ function test() { gSources._hideConditionalPopup(); initialCheck(22); yield resumeAndTestThrownMessage(18); yield resumeAndTestNoThrownMessage(19); yield resumeAndTestThrownMessage(22); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-contextmenu-add.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-contextmenu-add.js @@ -5,17 +5,21 @@ /** * Test adding breakpoints from the source editor context menu */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu"); const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-contextmenu.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-contextmenu.js @@ -9,17 +9,21 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); Task.spawn(function* () { - const [gTab,, gPanel ] = yield initDebugger(TAB_URL); + const options = { + source: "-01.js", + line: 1 + }; + const [gTab,, gPanel ] = yield initDebugger(TAB_URL, options); const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; const addBreakpoints = Task.async(function* () { yield actions.addBreakpoint({ actor: gSources.values[0], line: 5 }); @@ -209,18 +213,16 @@ function test() { } function enableAll() { gSources._onEnableAll(); } function deleteAll() { gSources._onDeleteAll(); } - yield waitForSourceShown(gPanel, "-01.js"); - yield addBreakpoints(); yield initialChecks(); yield checkBreakpointToggleSelf(0); yield checkBreakpointToggleOthers(0); yield checkBreakpointToggleSelf(1); yield checkBreakpointToggleOthers(1); yield checkBreakpointToggleSelf(2); yield checkBreakpointToggleOthers(2);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-disabled-reload.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-disabled-reload.js @@ -5,30 +5,33 @@ /** * Test that disabled breakpoints survive target navigation. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gPanel = aPanel; const gTab = aTab; const gDebugger = gPanel.panelWin; const gEvents = gDebugger.EVENTS; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; let gBreakpointLocation; Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); gBreakpointLocation = { actor: getSourceActor(gSources, EXAMPLE_URL + "code_script-switching-01.js"), line: 5 }; yield actions.addBreakpoint(gBreakpointLocation); yield ensureThreadClientState(gPanel, "resumed"); yield testWhenBreakpointEnabledAndFirstSourceShown();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-editor.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-editor.js @@ -6,17 +6,21 @@ /** * Bug 723069: Test the debugger breakpoint API and connection to the * source editor. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-eval.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-eval.js @@ -5,26 +5,28 @@ /** * Test setting breakpoints on an eval script */ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-eval.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const actions = bindActionCreators(gPanel); Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-eval.js"); - let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE); callInTab(gTab, "evalSourceWithSourceURL"); yield newSource; // Wait for it to be added to the UI yield waitForTick(); const newSourceActor = getSourceActor(gSources, EXAMPLE_URL + "bar.js"); yield actions.addBreakpoint({
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-highlight.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-highlight.js @@ -5,17 +5,21 @@ /** * Test if breakpoints are highlighted when they should. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; @@ -69,18 +73,16 @@ function test() { "The first source is correctly displayed."); } else { is(gEditor.getText().indexOf("debugger"), 166, "The second source is correctly displayed."); } } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); - yield addBreakpoints(); yield clickBreakpointAndCheck(0, 0, 5); yield clickBreakpointAndCheck(1, 1, 6); yield clickBreakpointAndCheck(2, 1, 7); yield clickBreakpointAndCheck(3, 1, 8); yield clickBreakpointAndCheck(4, 1, 9); closeDebuggerAndFinish(gPanel); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-new-script.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-new-script.js @@ -6,17 +6,21 @@ /** * Bug 771452: Make sure that setting a breakpoint in an inline source doesn't * add it twice. */ const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require('./content/queries'); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; @@ -65,23 +69,24 @@ function test() { EventUtils.sendMouseEvent({ type: "mousedown" }, gDebugger.document.getElementById("resume"), gDebugger); return deferred.promise; } Task.spawn(function(){ - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 16); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 16); + callInTab(gTab, "runDebuggerStatement"); + yield onCaretUpdated; + is(gDebugger.gThreadClient.state, "paused", "The debugger statement was reached."); ok(isCaretPos(gPanel, 16), "The source editor caret position is incorrect (1)."); yield actions.addBreakpoint({ actor: getSourceActor(gSources, TAB_URL), line: 20 }); yield testResume(); yield testBreakpointHit(); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "runDebuggerStatement"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-other-tabs.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-other-tabs.js @@ -6,24 +6,26 @@ /** * Make sure that setting a breakpoint in one tab, doesn't cause another tab at * the same source to pause at that location. */ const TAB_URL = EXAMPLE_URL + "doc_breakpoints-other-tabs.html"; var test = Task.async(function* () { - const [tab1,, panel1] = yield initDebugger(TAB_URL); - const [tab2,, panel2] = yield initDebugger(TAB_URL); + const options = { + source: "code_breakpoints-other-tabs.js", + line: 1 + }; + const [tab1,, panel1] = yield initDebugger(TAB_URL, options); + const [tab2,, panel2] = yield initDebugger(TAB_URL, options); const queries = panel1.panelWin.require("./content/queries"); const actions = bindActionCreators(panel1); const getState = panel1.panelWin.DebuggerController.getState; - yield ensureSourceIs(panel1, "code_breakpoints-other-tabs.js", true); - const sources = panel1.panelWin.DebuggerView.Sources; yield actions.addBreakpoint({ actor: queries.getSelectedSource(getState()).actor, line: 2 }); const paused = waitForThreadEvents(panel2, "paused");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-pane.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-pane.js @@ -6,17 +6,21 @@ /** * Bug 723071: Test adding a pane to display the list of breakpoints across * all sources in the debuggee. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-reload.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-reload.js @@ -8,21 +8,23 @@ * hit when we reload. */ const TAB_URL = EXAMPLE_URL + "doc_breakpoints-reload.html"; var test = Task.async(function* () { requestLongerTimeout(4); - const [tab,, panel] = yield initDebugger(TAB_URL); + const options = { + source: TAB_URL, + line: 1 + }; + const [tab,, panel] = yield initDebugger(TAB_URL, options); const actions = bindActionCreators(panel); - yield ensureSourceIs(panel, "doc_breakpoints-reload.html", true); - const sources = panel.panelWin.DebuggerView.Sources; yield actions.addBreakpoint({ actor: sources.selectedValue, line: 10 // "break on me" string }); const paused = waitForThreadEvents(panel, "paused"); reloadActiveTab(panel);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_bug-896139.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_bug-896139.js @@ -2,35 +2,43 @@ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Bug 896139 - Breakpoints not triggering when reloading script. */ -const TAB_URL = "doc_bug-896139.html"; +const TAB_URL = EXAMPLE_URL + "doc_bug-896139.html"; const SCRIPT_URL = "code_bug-896139.js"; function test() { Task.spawn(function* () { function testBreakpoint() { let promise = waitForDebuggerEvents(panel, win.EVENTS.FETCHED_SCOPES); callInTab(tab, "f"); return promise.then(() => doResume(panel)); } - let [tab,, panel] = yield initDebugger(EXAMPLE_URL + TAB_URL); + let [tab,, panel] = yield initDebugger(); let win = panel.panelWin; let Sources = win.DebuggerView.Sources; - yield waitForDebuggerEvents(panel, win.EVENTS.SOURCE_SHOWN); - if (Sources.selectedItem.attachment.source.url.indexOf(SCRIPT_URL) === -1) { - Sources.selectedValue = getSourceActor(win.DebuggerView.Sources, EXAMPLE_URL + SCRIPT_URL); - } + + // Load the debugger against a blank document and load the test url only + // here. That to allow catching SOURCE_SHOWN event for SCRIPT_URL. + // Here the load of TAB_URL is going to dispatch two SOURCE_SHOWN. + // One for the HTML page and another for the JS file which is dynamically + // inserted on load event. + let onSource = waitForSourceAndCaret(panel, SCRIPT_URL, 1); + yield navigateActiveTabTo(panel, + TAB_URL, + win.EVENTS.SOURCE_SHOWN); + yield onSource; + yield panel.addBreakpoint({ actor: getSourceActor(win.DebuggerView.Sources, EXAMPLE_URL + SCRIPT_URL), line: 6 }); // Race condition: the setBreakpoint request sometimes leaves the // debugger in paused state for a bit because we are called before
--- a/devtools/client/debugger/test/mochitest/browser_dbg_clean-exit-window.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_clean-exit-window.js @@ -8,17 +8,17 @@ */ var gDebuggee, gPanel, gDebugger, gWindow; const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html"; function test() { addWindow(TAB_URL) - .then(win => initDebugger(TAB_URL, win)) + .then(win => initDebugger(TAB_URL, { window: win })) .then(([aTab, aDebuggee, aPanel, aWindow]) => { gDebuggee = aDebuggee; gPanel = aPanel; gDebugger = gPanel.panelWin; gWindow = aWindow; return testCleanExit(); })
--- a/devtools/client/debugger/test/mochitest/browser_dbg_clean-exit.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_clean-exit.js @@ -7,17 +7,21 @@ * Test that closing a tab with the debugger in a paused state exits cleanly. */ var gTab, gPanel, gDebugger; const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + const options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; testCleanExit(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js @@ -5,23 +5,26 @@ const TAB_URL = EXAMPLE_URL + "doc_closures.html"; // Test that inspecting a closure works as expected. function test() { let gPanel, gTab, gDebugger; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; - waitForSourceShown(gPanel, ".html") - .then(testClosure) + testClosure() .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); function testClosure() { generateMouseClickInTab(gTab, "content.document.querySelector('button')");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-01.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { // Linux debug test slaves are a bit slow at this test sometimes. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); @@ -166,17 +170,20 @@ function test() { "There should be a selected source in the sources pane."); ok(gSources._selectedBreakpoint, "There should be a selected breakpoint in the sources pane."); is(gSources._conditionalPopupVisible, false, "The breakpoint conditional expression popup should not be shown."); }); Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; + yield addBreakpoints(); is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(queries.getSourceCount(getState()), 1, "Found the expected number of sources."); is(gEditor.getText().indexOf("ermahgerd"), 253, "The correct source was loaded initially."); @@ -202,12 +209,10 @@ function test() { yield sourceShown; testAfterReload(); // Reset traits back to default value client.mainRoot.traits.conditionalBreakpoints = true; closeDebuggerAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-02.js @@ -5,17 +5,21 @@ /** * Bug 740825: Test the debugger conditional breakpoints. */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); @@ -123,17 +127,19 @@ function test() { function waitForConditionUpdate() { // This will close the popup and send another request to update // the condition gSources._hideConditionalPopup(); return waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(queries.getSourceCount(getState()), 1, "Found the expected number of sources."); is(gEditor.getText().indexOf("ermahgerd"), 253, "The correct source was loaded initially."); is(gSources.selectedValue, gSources.values[0], @@ -194,12 +200,10 @@ function test() { is(gSources._selectedBreakpoint.location.line, 20, "The selected breakpoint is line 20"); testBreakpoint(20, true, "bamboocha"); // Reset traits back to default value client.mainRoot.traits.conditionalBreakpoints = true; resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-03.js @@ -5,17 +5,17 @@ /** * Tests that conditional breakpoint expressions survive disabled breakpoints. */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + initDebugger().then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; @@ -28,17 +28,23 @@ function test() { function waitForConditionUpdate() { // This will close the popup and send another request to update // the condition gSources._hideConditionalPopup(); return waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretUpdated(gPanel, 17); + yield navigateActiveTabTo(gPanel, + TAB_URL, + gDebugger.EVENTS.SOURCE_SHOWN); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; + const location = { actor: gSources.selectedValue, line: 18 }; yield actions.addBreakpoint(location, "hello"); yield actions.disableBreakpoint(location); yield actions.addBreakpoint(location); const bp = queries.getBreakpoint(getState(), location); is(bp.condition, "hello", "The conditional expression is correct."); @@ -63,12 +69,10 @@ function test() { gDebugger); yield finished; is(textbox.value, "foo", "The expression is correct (3)."); // Reset traits back to default value client.mainRoot.traits.conditionalBreakpoints = true; resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-04.js @@ -6,42 +6,47 @@ /** * Make sure that conditional breakpoints with blank expressions * maintain their conditions after enabling them. */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; // This test forces conditional breakpoints to be evaluated on the // client-side var client = gPanel.target.client; client.mainRoot.traits.conditionalBreakpoints = false; Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; + const location = { actor: gSources.selectedValue, line: 18 }; yield actions.addBreakpoint(location, ""); yield actions.disableBreakpoint(location); yield actions.addBreakpoint(location); const bp = queries.getBreakpoint(getState(), location); is(bp.condition, "", "The conditional expression is correct."); // Reset traits back to default value client.mainRoot.traits.conditionalBreakpoints = true; resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_conditional-breakpoints-05.js @@ -6,17 +6,21 @@ /** * Make sure that conditional breakpoints with an exception-throwing expression * could pause on hit */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); @@ -95,17 +99,19 @@ function test() { isnot(selectedBreakpoint.condition, undefined, "The breakpoint on line " + line + " should have a conditional expression."); ok(isCaretPos(gPanel, line), "The editor caret position is not properly set."); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; yield actions.addBreakpoint( { actor: gSources.selectedValue, line: 18 }, " 1a" ); yield actions.addBreakpoint( { actor: gSources.selectedValue, line: 19 }, "new Error()" ); yield actions.addBreakpoint( @@ -126,12 +132,10 @@ function test() { yield resumeAndTestBreakpoint(20); yield resumeAndTestBreakpoint(23); yield resumeAndTestNoBreakpoint(); // Reset traits back to default value client.mainRoot.traits.conditionalBreakpoints = true; closeDebuggerAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_console-eval.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_console-eval.js @@ -6,17 +6,17 @@ /** * Breaking in the middle of a script evaluated by the console should * work */ function test() { Task.spawn(function* () { let TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html"; - let [,, panel] = yield initDebugger(TAB_URL); + let [,, panel] = yield initDebugger(TAB_URL, { source: null }); let dbgWin = panel.panelWin; let sources = dbgWin.DebuggerView.Sources; let frames = dbgWin.DebuggerView.StackFrames; let editor = dbgWin.DebuggerView.editor; let toolbox = gDevTools.getToolbox(panel.target); let paused = promise.all([ waitForEditorEvents(panel, "cursorActivity"),
--- a/devtools/client/debugger/test/mochitest/browser_dbg_console-named-eval.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_console-named-eval.js @@ -9,17 +9,17 @@ */ function test() { Task.spawn(runTests); } function* runTests() { let TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html"; - let [,, panel] = yield initDebugger(TAB_URL); + let [,, panel] = yield initDebugger(TAB_URL, { source: null }); let dbgWin = panel.panelWin; let sources = dbgWin.DebuggerView.Sources; let frames = dbgWin.DebuggerView.StackFrames; let editor = dbgWin.DebuggerView.editor; let toolbox = gDevTools.getToolbox(panel.target); let paused = waitForSourceAndCaretAndScopes(panel, "foo.js", 1);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_controller-evaluate-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_controller-evaluate-01.js @@ -6,17 +6,21 @@ /** * Tests the public evaluation API from the debugger controller. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { Task.spawn(function* () { - const [tab,, panel] = yield initDebugger(TAB_URL); + const options = { + source: "-01.js", + line: 1 + }; + const [tab,, panel] = yield initDebugger(TAB_URL, options); const win = panel.panelWin; const frames = win.DebuggerController.StackFrames; const framesView = win.DebuggerView.StackFrames; const sourcesView = win.DebuggerView.Sources; const editorView = win.DebuggerView.editor; const events = win.EVENTS; const queries = win.require("./content/queries"); const constants = win.require("./content/constants");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_controller-evaluate-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_controller-evaluate-02.js @@ -6,17 +6,21 @@ /** * Tests the public evaluation API from the debugger controller. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { Task.spawn(function* () { - const [tab,, panel] = yield initDebugger(TAB_URL); + const options = { + source: "-01.js", + line: 1 + }; + const [tab,, panel] = yield initDebugger(TAB_URL, options); const win = panel.panelWin; const frames = win.DebuggerController.StackFrames; const framesView = win.DebuggerView.StackFrames; const sourcesView = win.DebuggerView.Sources; const editorView = win.DebuggerView.editor; const events = win.EVENTS; const queries = win.require("./content/queries"); const constants = win.require("./content/constants");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_editor-contextmenu.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_editor-contextmenu.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { let gTab, gPanel, gDebugger; let gEditor, gSources, gContextMenu; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu"); waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1).then(performTest).then(null, info);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_editor-mode.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_editor-mode.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; var gTab, gPanel, gDebugger; var gEditor, gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "code_script-switching-01.js?a=b", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; waitForSourceAndCaretAndScopes(gPanel, "code_test-editor-mode", 1) .then(testInitialSource)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-04.js @@ -27,17 +27,21 @@ function test() { ok(sdkTab, "Add-on SDK found the loaded tab."); info("Attaching an event handler via add-on sdk content scripts."); let worker = sdkTab.attach({ contentScript: "document.body.addEventListener('click', e => alert(e))", onError: ok.bind(this, false) }); - let [,, panel, win] = yield initDebugger(tab); + let options = { + source: TAB_URL, + line: 1 + }; + let [,, panel, win] = yield initDebugger(tab, options); let dbg = panel.panelWin; let controller = dbg.DebuggerController; let constants = dbg.require("./content/constants"); let actions = dbg.require("./content/actions/event-listeners"); let fetched = waitForDispatch(panel, constants.FETCH_EVENT_LISTENERS); info("Scheduling event listener fetch."); controller.dispatch(actions.fetchEventListeners());
--- a/devtools/client/debugger/test/mochitest/browser_dbg_file-reload.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_file-reload.js @@ -6,28 +6,31 @@ /** * Tests that source contents are invalidated when the target navigates. */ const TAB_URL = EXAMPLE_URL + "doc_random-javascript.html"; const JS_URL = EXAMPLE_URL + "sjs_random-javascript.sjs"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: JS_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gPanel = aPanel; const gDebugger = aPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceShown(gPanel, JS_URL); let source = queries.getSelectedSource(getState()); is(queries.getSourceCount(getState()), 1, "There should be one source displayed in the view."); is(source.url, JS_URL, "The correct source is currently selected in the view."); ok(gEditor.getText().includes("bacon"), "The currently shown source contains bacon. Mmm, delicious!");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_function-display-name.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_function-display-name.js @@ -8,40 +8,45 @@ * their displayName property or a SpiderMonkey-inferred name. */ const TAB_URL = EXAMPLE_URL + "doc_function-display-name.html"; var gTab, gPanel, gDebugger; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; testAnonCall(); }); } function testAnonCall() { - waitForSourceAndCaretAndScopes(gPanel, ".html", 15).then(() => { + let onCaretUpdated = waitForCaretUpdated(gPanel, 15); + let onScopes = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES); + callInTab(gTab, "evalCall"); + promise.all([onCaretUpdated, onScopes]).then(() => { ok(isCaretPos(gPanel, 15), "The source editor caret position was incorrect."); is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(gDebugger.document.querySelectorAll(".dbg-stackframe").length, 3, "Should have three frames."); is(gDebugger.document.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"), "anonFunc", "Frame name should be 'anonFunc'."); testInferredName(); }); - - callInTab(gTab, "evalCall"); } function testInferredName() { waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => { ok(isCaretPos(gPanel, 15), "The source editor caret position was incorrect."); is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_global-method-override.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_global-method-override.js @@ -7,16 +7,20 @@ * Tests that scripts that override properties of the global object, like * toString don't break the debugger. The test page used to cause the debugger * to throw when trying to attach to the thread actor. */ const TAB_URL = EXAMPLE_URL + "doc_global-method-override.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let gDebugger = aPanel.panelWin; ok(gDebugger, "Should have a debugger available."); is(gDebugger.gThreadClient.state, "attached", "Debugger should be attached."); closeDebuggerAndFinish(aPanel); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_hide-toolbar-buttons.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_hide-toolbar-buttons.js @@ -11,17 +11,21 @@ const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html"; var { RootActor } = require("devtools/server/actors/root"); function test() { RootActor.prototype.traits.noBlackBoxing = true; RootActor.prototype.traits.noPrettyPrinting = true; - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: "code_ugly-5.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { let document = aPanel.panelWin.document; let ppButton = document.querySelector("#pretty-print"); let bbButton = document.querySelector("#black-box"); let sep = document.querySelector("#sources-toolbar .devtools-separator"); is(ppButton.style.display, "none", "The pretty-print button is hidden"); is(bbButton.style.display, "none", "The blackboxing button is hidden"); is(sep.style.display, "none", "The separator is hidden");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_host-layout.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_host-layout.js @@ -30,17 +30,17 @@ function test() { function testHosts(aHostTypes, aLayoutTypes) { let [firstHost, secondHost, thirdHost] = aHostTypes; let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes; Services.prefs.setCharPref("devtools.toolbox.host", getHost(firstHost)); return Task.spawn(function*() { - let [tab, debuggee, panel] = yield initDebugger("about:blank"); + let [tab, debuggee, panel] = yield initDebugger(); if (getHost(firstHost) === "window") { yield resizeToolboxWindow(panel, firstHost); } yield testHost(panel, getHost(firstHost), firstLayout); yield switchAndTestHost(tab, panel, secondHost, secondLayout); yield switchAndTestHost(tab, panel, thirdHost, thirdLayout); yield teardown(panel);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_iframes.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_iframes.js @@ -8,29 +8,32 @@ */ const TAB_URL = EXAMPLE_URL + "doc_iframes.html"; function test() { let gTab, gDebuggee, gPanel, gDebugger; let gIframe, gEditor, gSources, gFrames; - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: "inline-debugger-statement.html", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { gTab = aTab; gDebuggee = aDebuggee; gPanel = aPanel; gDebugger = gPanel.panelWin; gIframe = gDebuggee.frames[0]; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; - waitForSourceShown(gPanel, "inline-debugger-statement.html") - .then(checkIframeSource) - .then(checkIframePause) + checkIframeSource(); + checkIframePause() .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); function checkIframeSource() { is(gDebugger.gThreadClient.paused, false,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_instruments-pane-collapse.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_instruments-pane-collapse.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gPrefs, gOptions; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; testPanesState();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_interrupts.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_interrupts.js @@ -8,30 +8,33 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gBreakpoints = gDebugger.DebuggerController.Breakpoints; gTarget = gDebugger.gTarget; gThreadClient = gDebugger.gThreadClient; gResumeButton = gDebugger.document.getElementById("resume"); gResumeKey = gDebugger.document.getElementById("resumeKey"); - waitForSourceShown(gPanel, "-01.js") - .then(() => { gTarget.on("thread-paused", failOnPause); }) - .then(addBreakpoints) + gTarget.on("thread-paused", failOnPause); + addBreakpoints() .then(() => { gTarget.off("thread-paused", failOnPause); }) .then(testResumeButton) .then(testResumeKeyboard) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_jump-to-function-definition.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_jump-to-function-definition.js @@ -9,24 +9,27 @@ const TAB_URL = EXAMPLE_URL + "doc_function-jump.html"; const SCRIPT_URI = EXAMPLE_URL + "code_function-jump-01.js"; function test() { let gTab, gPanel, gDebugger, gSources; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, "-01.js") - .then(jumpToFunctionDefinition) + jumpToFunctionDefinition() .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); function jumpToFunctionDefinition() { let callLocation = {line: 5, ch: 0};
--- a/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-01-simple.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-01-simple.js @@ -5,27 +5,33 @@ /** * Make sure that changing the tab location URL works. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gFrames = gDebugger.DebuggerView.StackFrames; const constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 14); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 14); + callInTab(gTab, "simpleCall"); + yield onCaretUpdated; is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(gFrames.itemCount, 1, "Should have only one frame."); is(gSources.itemCount, 1, @@ -45,12 +51,10 @@ function test() { is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-notice > label"), null, "The sources widget should not display a notice at this point (3)."); yield doResume(gPanel); navigateActiveTabTo(gPanel, "about:blank"); yield waitForDispatch(gPanel, constants.UNLOAD); closeDebuggerAndFinish(gPanel); }); - - callInTab(gTab, "simpleCall"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-02-blank.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-02-blank.js @@ -5,27 +5,33 @@ /** * Make sure that changing the tab location URL to a page with no sources works. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gFrames = gDebugger.DebuggerView.StackFrames; const constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 14); + let onCaretUpdated = waitForCaretUpdated(gPanel, 14); + callInTab(gTab, "simpleCall"); + yield onCaretUpdated; navigateActiveTabTo(gPanel, "about:blank"); yield waitForNavigation(gPanel); isnot(gDebugger.gThreadClient.state, "paused", "Should not be paused after a tab navigation."); is(gFrames.itemCount, 0, @@ -42,12 +48,10 @@ function test() { is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 1, "The sources widget should now display a notice (1)."); is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text")[0].getAttribute("value"), gDebugger.L10N.getStr("noSourcesText"), "The sources widget should now display a notice (2)."); closeDebuggerAndFinish(gPanel); }); - - callInTab(gTab, "simpleCall"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-03-new.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-03-new.js @@ -6,28 +6,34 @@ /** * Make sure that changing the tab location URL to a page with other sources works. */ const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html"; const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html"; function test() { - initDebugger(TAB_URL_1).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: TAB_URL_1, + line: 1 + }; + initDebugger(TAB_URL_1, options).then(([aTab, aDebuggee, aPanel]) => { const gTab = aTab; const gDebuggee = aDebuggee; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gFrames = gDebugger.DebuggerView.StackFrames; const constants = gDebugger.require("./content/constants"); Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 14); + let onCaretUpdated = waitForCaretUpdated(gPanel, 14); + callInTab(gTab, "simpleCall"); + yield onCaretUpdated; const startedLoading = waitForNextDispatch(gDebugger.DebuggerController, constants.LOAD_SOURCE_TEXT); navigateActiveTabTo(gPanel, TAB_URL_2); yield startedLoading; isnot(gDebugger.gThreadClient.state, "paused", "Should not be paused after a tab navigation."); @@ -44,12 +50,10 @@ function test() { "The source editor text should be 'Loading...'"); is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 0, "The sources widget should not display any notice at this point."); yield waitForDispatch(gPanel, constants.LOAD_SOURCE_TEXT); closeDebuggerAndFinish(gPanel); }); - - gDebuggee.simpleCall(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-04-breakpoint.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-04-breakpoint.js @@ -7,17 +7,21 @@ * Make sure that reloading a page with a breakpoint set does not cause it to * fire more than once. */ const TAB_URL = EXAMPLE_URL + "doc_included-script.html"; const SOURCE_URL = EXAMPLE_URL + "code_location-changes.js"; function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + const options = { + source: SOURCE_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { const gTab = aTab; const gDebuggee = aDebuggee; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); @@ -25,17 +29,19 @@ function test() { function clickButtonAndPause() { const paused = waitForPause(gDebugger.gThreadClient); BrowserTestUtils.synthesizeMouse("button", 2, 2, {}, gBrowser.selectedBrowser); return paused; } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretUpdated(gPanel, 17); + callInTab(gTab, "runDebuggerStatement"); + yield onCaretUpdated; const location = { actor: getSourceActor(gSources, SOURCE_URL), line: 5 }; yield actions.addBreakpoint(location); const caretUpdated = waitForSourceAndCaret(gPanel, ".js", 5); gSources.highlightBreakpoint(location); yield caretUpdated; ok(true, "Switched to the desired function when adding a breakpoint"); @@ -150,12 +156,10 @@ function test() { is(gEditor.getText().indexOf("debugger"), 148, "The correct source is shown in the source editor."); is(gEditor.getBreakpoints().length, 1, "One breakpoint should be shown for the first source."); yield ensureCaretAt(gPanel, 6, 1, true); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "runDebuggerStatement"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_no-dangling-breakpoints.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_no-dangling-breakpoints.js @@ -4,17 +4,17 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Bug 1201008 - Make sure you can't set a breakpoint in a blank * editor */ function test() { - initDebugger("data:text/html,hi").then(([aTab,, aPanel]) => { + initDebugger('data:text/html,hi', { source: null }).then(([aTab,, aPanel]) => { const gPanel = aPanel; const gDebugger = gPanel.panelWin; Task.spawn(function* () { const editor = gDebugger.DebuggerView.editor; editor.emit("gutterClick", 0); is(editor.getBreakpoints().length, 0, "A breakpoint should not exist");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_no-page-sources.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_no-page-sources.js @@ -8,17 +8,17 @@ */ const TAB_URL = EXAMPLE_URL + "doc_no-page-sources.html"; var gTab, gDebuggee, gPanel, gDebugger; var gEditor, gSources; function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + initDebugger(TAB_URL, { source: null }).then(([aTab, aDebuggee, aPanel]) => { gTab = aTab; gDebuggee = aDebuggee; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; const constants = gDebugger.require("./content/constants");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_on-pause-highlight.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_on-pause-highlight.js @@ -9,24 +9,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gToolbox, gToolboxTab; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gToolbox = gPanel._toolbox; gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger"); - waitForSourceShown(gPanel, ".html").then(testPause); + testPause(); }); } function testPause() { is(gDebugger.gThreadClient.paused, false, "Should be running after starting test."); gDebugger.gThreadClient.addOneTimeListener("paused", () => {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_on-pause-raise.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_on-pause-raise.js @@ -8,24 +8,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gFocusedWindow, gToolbox, gToolboxTab; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gToolbox = gPanel._toolbox; gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger"); - waitForSourceShown(gPanel, ".html").then(performTest); + performTest(); }); } function performTest() { addTab(TAB_URL).then(aTab => { isnot(aTab, gTab, "The newly added tab is different from the debugger's tab."); is(gBrowser.selectedTab, aTab,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_optimized-out-vars.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_optimized-out-vars.js @@ -5,21 +5,24 @@ // Test that optimized out variables aren't present in the variables view. function test() { Task.spawn(function* () { const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html"; let gDebugger, sources; - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); gDebugger = panel.panelWin; sources = gDebugger.DebuggerView.Sources; - yield waitForSourceShown(panel, ".html"); yield panel.addBreakpoint({ actor: sources.values[0], line: 18 }); yield ensureThreadClientState(panel, "resumed"); // Spin the event loop before causing the debuggee to pause, to allow // this function to return first. generateMouseClickInTab(tab, "content.document.querySelector('button')");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_panel-size.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_panel-size.js @@ -9,25 +9,29 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { let gTab, gPanel, gDebugger; let gPrefs, gSources, gInstruments; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gPrefs = gDebugger.Prefs; gSources = gDebugger.document.getElementById("workers-and-sources-pane"); gInstruments = gDebugger.document.getElementById("instruments-pane"); - waitForSourceShown(gPanel, ".html").then(performTest); + performTest(); }); function performTest() { let preferredWsw = Services.prefs.getIntPref("devtools.debugger.ui.panes-workers-and-sources-width"); let preferredIw = Services.prefs.getIntPref("devtools.debugger.ui.panes-instruments-width"); let someWidth1, someWidth2; do {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pause-exceptions-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pause-exceptions-01.js @@ -9,17 +9,21 @@ const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html"; var gTab, gPanel, gDebugger; var gFrames, gVariables, gPrefs, gOptions; function test() { requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gVariables = gDebugger.DebuggerView.Variables; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pause-exceptions-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pause-exceptions-02.js @@ -8,32 +8,35 @@ */ const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html"; var gTab, gPanel, gDebugger; var gFrames, gVariables, gPrefs, gOptions; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gVariables = gDebugger.DebuggerView.Variables; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; is(gPrefs.pauseOnExceptions, false, "The pause-on-exceptions pref should be disabled by default."); isnot(gOptions._pauseOnExceptionsItem.getAttribute("checked"), "true", "The pause-on-exceptions menu item should not be checked."); - waitForSourceShown(aPanel, ".html") - .then(enablePauseOnExceptions) + enablePauseOnExceptions() .then(disableIgnoreCaughtExceptions) .then(() => reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN)) .then(() => { generateMouseClickInTab(gTab, "content.document.querySelector('button')"); }) .then(testPauseOnExceptionsAfterReload) .then(disablePauseOnExceptions) .then(enableIgnoreCaughtExceptions)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pause-no-step.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pause-no-step.js @@ -10,17 +10,21 @@ const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html"; var gTab, gPanel, gDebugger; var gResumeButton, gStepOverButton, gStepOutButton, gStepInButton; var gResumeKey, gFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gResumeButton = gDebugger.document.getElementById("resume"); gStepOverButton = gDebugger.document.getElementById("step-over"); gStepInButton = gDebugger.document.getElementById("step-in"); gStepOutButton = gDebugger.document.getElementById("step-out"); gResumeKey = gDebugger.document.getElementById("resumeKey");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pause-resume.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pause-resume.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html"; var gTab, gPanel, gDebugger; var gResumeButton, gResumeKey, gFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gResumeButton = gDebugger.document.getElementById("resume"); gResumeKey = gDebugger.document.getElementById("resumeKey"); gFrames = gDebugger.DebuggerView.StackFrames; testPause();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pause-warning.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pause-warning.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; var gTab, gPanel, gDebugger; var gTarget, gToolbox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gTarget = gPanel.target; gToolbox = gPanel._toolbox; testPause(); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_paused-keybindings.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_paused-keybindings.js @@ -6,32 +6,35 @@ // Test that keybindings still work when the content window is paused and // the tab is selected again. function test() { Task.spawn(function* () { const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; let gDebugger, searchBox; - let [, debuggee, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab, debuggee, panel] = yield initDebugger(TAB_URL, options); gDebugger = panel.panelWin; searchBox = gDebugger.DebuggerView.Filtering._searchbox; - // Spin the event loop before causing the debuggee to pause, to allow - // this function to return first. - executeSoon(() => { - EventUtils.sendMouseEvent({ type: "click" }, - debuggee.document.querySelector("button"), - debuggee); + let onCaretUpdated = ensureCaretAt(panel, 20, 1, true); + let onThreadPaused = ensureThreadClientState(panel, "paused"); + ContentTask.spawn(tab.linkedBrowser, {}, function* () { + content.document.querySelector("button").click(); }); - yield waitForSourceAndCaretAndScopes(panel, ".html", 20); - yield ensureThreadClientState(panel, "paused"); + yield onCaretUpdated; + yield onThreadPaused // Now open a tab and close it. let tab2 = yield addTab(TAB_URL); + yield waitForTick(); yield removeTab(tab2); yield ensureCaretAt(panel, 20); // Try to use the Cmd-L keybinding to see if it still works. let caretMove = ensureCaretAt(panel, 15, 1, true); // Wait a tick for the editor focus event to occur first. executeSoon(function () { EventUtils.synthesizeKey("l", { accelKey: true });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_post-page.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_post-page.js @@ -9,26 +9,26 @@ const TAB_URL = EXAMPLE_URL + "sjs_post-page.sjs"; const FORM = "<form method=\"POST\"><input type=\"submit\"></form>"; const GET_CONTENT = "<script>\"GET\";</script>" + FORM; const POST_CONTENT = "<script>\"POST\";</script>" + FORM; add_task(function* () { - let [tab,, panel] = yield initDebugger("about:blank"); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let editor = win.DebuggerView.editor; let queries = win.require("./content/queries"); let getState = win.DebuggerController.getState; - yield navigateActiveTabTo(panel, - TAB_URL, - win.EVENTS.SOURCE_SHOWN); - let source = queries.getSelectedSource(getState()); is(queries.getSourceCount(getState()), 1, "There should be one source displayed in the view."); is(source.url, TAB_URL, "The correct source is currently selected in the view."); is(editor.getText(), GET_CONTENT, "The currently shown source contains bacon. Mmm, delicious!");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-01.js @@ -5,30 +5,33 @@ /** * Make sure that clicking the pretty print button prettifies the source. */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly.js", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceShown(gPanel, "code_ugly.js"); - ok(!gEditor.getText().includes("\n "), "The source shouldn't be pretty printed yet."); const finished = waitForSourceShown(gPanel, "code_ugly.js"); gDebugger.document.getElementById("pretty-print").click(); const deck = gDebugger.document.getElementById("editor-deck"); is(deck.selectedIndex, 2, "The progress bar should be shown"); yield finished; @@ -38,12 +41,12 @@ function test() { is(deck.selectedIndex, 0, "The editor should be shown"); const source = queries.getSelectedSource(getState()); const { loading, text } = queries.getSourceText(getState(), source.actor); ok(!loading, "Source text is not loading"); ok(text.includes("\n "), "Subsequent calls to getText return the pretty printed source."); - closeDebuggerAndFinish(gPanel); + resumeDebuggerThenCloseAndFinish(gPanel); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-02.js @@ -6,33 +6,36 @@ /** * Make sure that right clicking and selecting the pretty print context menu * item prettifies the source. */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly.js", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu"); Task.spawn(function* () { - yield waitForSourceShown(gPanel, "code_ugly.js"); - const finished = waitForSourceShown(gPanel, "code_ugly.js"); once(gContextMenu, "popupshown").then(() => { const menuItem = gDebugger.document.getElementById("se-dbg-cMenu-prettyPrint"); menuItem.click(); }); gContextMenu.openPopup(gEditor.container, "overlap", 0, 0, true, false); yield finished; ok(gEditor.getText().includes("\n "), "The source should be pretty printed."); - closeDebuggerAndFinish(gPanel); + resumeDebuggerThenCloseAndFinish(gPanel); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-03.js @@ -5,23 +5,28 @@ /** * Make sure that we have the correct line selected after pretty printing. */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly.js", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; Task.spawn(function* () { - yield waitForSourceShown(gPanel, "code_ugly.js"); + yield doResume(gPanel); const paused = waitForPause(gDebugger.gThreadClient); callInTab(gTab, "foo"); yield paused; const finished = promise.all([ waitForSourceShown(gPanel, "code_ugly.js"), waitForCaretUpdated(gPanel, 7)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-04.js @@ -5,25 +5,28 @@ /** * Tests that the function searching works with pretty printed sources. */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly.js", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; Task.spawn(function* () { - yield waitForSourceShown(gPanel, "code_ugly.js"); - let popupShown = promise.defer(); once(gDebugger, "popupshown").then(() => { ok(isCaretPos(gPanel, 2, 10), "The bar function's non-pretty-printed location should be shown."); popupShown.resolve(); }); setText(gSearchBox, "@bar"); yield popupShown.promise; @@ -36,12 +39,12 @@ function test() { once(gDebugger, "popupshown").then(() => { ok(isCaretPos(gPanel, 6, 10), "The bar function's pretty printed location should be shown."); popupShown.resolve(); }); setText(gSearchBox, "@bar"); yield popupShown.promise; - closeDebuggerAndFinish(gPanel); + resumeDebuggerThenCloseAndFinish(gPanel); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-05.js @@ -3,31 +3,39 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Make sure that prettifying HTML sources doesn't do anything. */ const TAB_URL = EXAMPLE_URL + "doc_included-script.html"; +const SCRIPT_URL = EXAMPLE_URL + "code_location-changes.js"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: SCRIPT_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceShown(gPanel, TAB_URL); + // Now, select the html page + const sourceShown = waitForSourceShown(gPanel, TAB_URL); + gSources.selectedValue = getSourceActor(gSources, TAB_URL); + yield sourceShown; // From this point onward, the source editor's text should never change. gEditor.once("change", () => { ok(false, "The source editor text shouldn't have changed."); }); is(getSelectedSourceURL(gSources), TAB_URL, "The correct source is currently selected."); @@ -51,16 +59,8 @@ function test() { "The displayed source hasn't changed."); ok(text.includes("myFunction"), "The cached source text wasn't altered in any way."); yield closeDebuggerAndFinish(gPanel); }); }); } - -function prepareDebugger(aPanel) { - aPanel._view.Sources.preferredSource = getSourceActor( - aPanel.panelWin.DebuggerView.Sources, - TAB_URL - ); -} -
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-06.js @@ -6,17 +6,21 @@ /** * Make sure that prettifying JS sources with type errors works as expected. */ const TAB_URL = EXAMPLE_URL + "doc_included-script.html"; const JS_URL = EXAMPLE_URL + "code_location-changes.js"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: JS_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gClient = gDebugger.gClient; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); @@ -34,18 +38,16 @@ function test() { gPrettyPrinted = true; return promise.reject({ error: "prettyPrintError" }); } return aOriginalRequestMethod(aPacket, aCallback); }; }(gClient.request)); Task.spawn(function* () { - yield waitForSourceShown(gPanel, JS_URL); - // From this point onward, the source editor's text should never change. gEditor.once("change", () => { ok(false, "The source editor text shouldn't have changed."); }); is(getSelectedSourceURL(gSources), JS_URL, "The correct source is currently selected."); ok(gEditor.getText().includes("myFunction"),
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-07.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-07.js @@ -6,17 +6,21 @@ // Test basic pretty printing functionality. Would be an xpcshell test, except // for bug 921252. var gTab, gPanel, gClient, gThreadClient, gSource; const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "code_ugly-2.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gClient = gPanel.panelWin.gClient; gThreadClient = gPanel.panelWin.DebuggerController.activeThread; findSource(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-08.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-08.js @@ -5,17 +5,21 @@ // Test stepping through pretty printed sources. var gTab, gPanel, gClient, gThreadClient, gSource; const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "code_ugly-2.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gClient = gPanel.panelWin.gClient; gThreadClient = gPanel.panelWin.DebuggerController.activeThread; findSource(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-09.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-09.js @@ -9,17 +9,21 @@ var gClient; var gThreadClient; var gSource; var gTab, gPanel, gClient, gThreadClient, gSource; const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "code_ugly-2.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gClient = gPanel.panelWin.gClient; gThreadClient = gPanel.panelWin.DebuggerController.activeThread; findSource(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-10.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-10.js @@ -6,39 +6,43 @@ /** * Make sure that we disable the pretty print button for black boxed sources, * and that clicking it doesn't do anything. */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly.js", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceShown(gPanel, "code_ugly.js"); - ok(!gEditor.getText().includes("\n "), "The source shouldn't be pretty printed yet."); yield toggleBlackBoxing(gPanel); // Wait a tick before clicking to make sure the frontend's blackboxchange // handlers have finished. yield waitForTick(); gDebugger.document.getElementById("pretty-print").click(); // Make sure the text updates yield waitForTick(); const source = queries.getSelectedSource(getState()); const { text } = queries.getSourceText(getState(), source.actor); ok(!text.includes("\n ")); - closeDebuggerAndFinish(gPanel); + + resumeDebuggerThenCloseAndFinish(gPanel); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-11.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-11.js @@ -8,33 +8,38 @@ */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html"; var gTab, gPanel, gDebugger; var gEditor, gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly.js", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, "code_ugly.js") - .then(testSourceIsUgly) + testSourceIsUgly(); + const finished = waitForCaretUpdated(gPanel, 7); + clickPrettyPrintButton(); + finished.then(testSourceIsPretty) .then(() => { - const finished = waitForSourceShown(gPanel, "code_ugly.js"); - clickPrettyPrintButton(); + const finished = waitForCaretUpdated(gPanel, 7); + reloadActiveTab(gPanel); return finished; }) .then(testSourceIsPretty) - .then(reloadActiveTab.bind(null, gPanel, gDebugger.EVENTS.SOURCE_SHOWN)) - .then(testSourceIsPretty) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError)); }); }); } function testSourceIsUgly() {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-12.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-12.js @@ -4,31 +4,35 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Make sure that we don't leave the pretty print button checked when we fail to * pretty print a source (because it isn't a JS file, for example). */ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; +const SCRIPT_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: SCRIPT_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceShown(gPanel, ""); const source = getSourceForm(gSources, TAB_URL); let shown = ensureSourceIs(gPanel, TAB_URL, true); actions.selectSource(source); yield shown; try { yield actions.togglePrettyPrint(source); ok(false, "An error occurred while pretty-printing");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-13.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-13.js @@ -7,29 +7,33 @@ * Make sure that clicking the pretty print button prettifies the source, even * when the source URL does not end in ".js", but the content type is * JavaScript. */ const TAB_URL = EXAMPLE_URL + "doc_pretty-print-3.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_ugly-8", + line: 2 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceShown(gPanel, "code_ugly-8"); ok(!gEditor.getText().includes("\n "), "The source shouldn't be pretty printed yet."); const finished = waitForSourceShown(gPanel, "code_ugly-8"); gDebugger.document.getElementById("pretty-print").click(); const deck = gDebugger.document.getElementById("editor-deck"); is(deck.selectedIndex, 2, "The progress bar should be shown"); yield finished; @@ -38,12 +42,12 @@ function test() { "The source should be pretty printed."); is(deck.selectedIndex, 0, "The editor should be shown"); const source = queries.getSelectedSource(getState()); const { text } = queries.getSourceText(getState(), source.actor); ok(text.includes("\n "), "Subsequent calls to getText return the pretty printed source."); - closeDebuggerAndFinish(gPanel); - }); + resumeDebuggerThenCloseAndFinish(gPanel); + }) }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-on-paused.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-on-paused.js @@ -10,27 +10,30 @@ const TAB_URL = EXAMPLE_URL + "doc_pretty-print-on-paused.html"; var gTab, gPanel, gDebugger, gThreadClient, gSources; const SECOND_SOURCE_VALUE = EXAMPLE_URL + "code_ugly-2.js"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: "code_script-switching-02.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gThreadClient = gDebugger.gThreadClient; gSources = gDebugger.DebuggerView.Sources; Task.spawn(function* () { try { - yield ensureSourceIs(gPanel, "code_script-switching-02.js", true); - yield doInterrupt(gPanel); let source = gThreadClient.source(getSourceForm(gSources, SECOND_SOURCE_VALUE)); yield source.setBreakpoint({ line: 6 }); yield doResume(gPanel);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_progress-listener-bug.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_progress-listener-bug.js @@ -11,37 +11,41 @@ var gTab, gPanel, gDebugger; var gOldListener; const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; function test() { installListener(); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; is(!!gDebugger.DebuggerController._startup, true, "Controller should be initialized after starting the test."); testPause(); }); } function testPause() { - waitForSourceAndCaretAndScopes(gPanel, ".html", 16).then(() => { + let onCaretUpdated = waitForCaretUpdated(gPanel, 16); + callInTab(gTab, "runDebuggerStatement"); + onCaretUpdated.then(() => { is(gDebugger.gThreadClient.state, "paused", "The debugger statement was reached."); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "runDebuggerStatement"); } // This is taken almost verbatim from bug 771655. function installListener() { if ("_testPL" in window) { gOldListener = _testPL; Cc["@mozilla.org/docloaderservice;1"]
--- a/devtools/client/debugger/test/mochitest/browser_dbg_promises-allocation-stack.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_promises-allocation-stack.js @@ -13,17 +13,21 @@ const TAB_URL = EXAMPLE_URL + "doc_promi const { PromisesFront } = require("devtools/server/actors/promises"); var events = require("sdk/event/core"); function test() { Task.spawn(function* () { DebuggerServer.init(); DebuggerServer.addBrowserActors(); - const [ tab,, panel ] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + const [ tab,, panel ] = yield initDebugger(TAB_URL, options); let client = new DebuggerClient(DebuggerServer.connectPipe()); yield connect(client); let { tabs } = yield listTabs(client); let targetTab = findTab(tabs, TAB_URL); yield attachTab(client, targetTab);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_promises-fulfillment-stack.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_promises-fulfillment-stack.js @@ -31,17 +31,21 @@ const TEST_DATA = [ }, ]; function test() { Task.spawn(function* () { DebuggerServer.init(); DebuggerServer.addBrowserActors(); - const [ tab,, panel ] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + const [ tab,, panel ] = yield initDebugger(TAB_URL, options); let client = new DebuggerClient(DebuggerServer.connectPipe()); yield connect(client); let { tabs } = yield listTabs(client); let targetTab = findTab(tabs, TAB_URL); yield attachTab(client, targetTab);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_promises-rejection-stack.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_promises-rejection-stack.js @@ -31,17 +31,21 @@ const TEST_DATA = [ }, ]; function test() { Task.spawn(function* () { DebuggerServer.init(); DebuggerServer.addBrowserActors(); - const [ tab,, panel ] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + const [ tab,, panel ] = yield initDebugger(TAB_URL, options); let client = new DebuggerClient(DebuggerServer.connectPipe()); yield connect(client); let { tabs } = yield listTabs(client); let targetTab = findTab(tabs, TAB_URL); yield attachTab(client, targetTab);
deleted file mode 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_reload-preferred-script-01.js +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests if the preferred source is shown when a page is loaded and - * the preferred source is specified before any other source was shown. - */ - -const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; -const PREFERRED_URL = EXAMPLE_URL + "code_script-switching-02.js"; - -var gTab, gDebuggee, gPanel, gDebugger; -var gSources; - -function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { - gTab = aTab; - gDebuggee = aDebuggee; - gPanel = aPanel; - gDebugger = gPanel.panelWin; - gSources = gDebugger.DebuggerView.Sources; - - waitForSourceShown(gPanel, PREFERRED_URL).then(finishTest); - }); -} - -function finishTest() { - info("Currently preferred source: " + gSources.preferredValue); - info("Currently selected source: " + gSources.selectedValue); - - is(getSourceURL(gSources, gSources.preferredValue), PREFERRED_URL, - "The preferred source url wasn't set correctly."); - is(getSourceURL(gSources, gSources.selectedValue), PREFERRED_URL, - "The selected source isn't the correct one."); - - closeDebuggerAndFinish(gPanel); -} - -function prepareDebugger(aPanel) { - let sources = aPanel._view.Sources; - sources.preferredSource = getSourceActor(sources, PREFERRED_URL); -} - -registerCleanupFunction(function () { - gTab = null; - gDebuggee = null; - gPanel = null; - gDebugger = null; - gSources = null; -});
--- a/devtools/client/debugger/test/mochitest/browser_dbg_reload-preferred-script-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_reload-preferred-script-02.js @@ -10,17 +10,21 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const PREFERRED_URL = EXAMPLE_URL + "code_script-switching-02.js"; var gTab, gPanel, gDebugger; var gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; waitForSourceShown(gPanel, PREFERRED_URL).then(finishTest); gSources.preferredSource = getSourceActor(gSources, PREFERRED_URL); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_reload-preferred-script-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_reload-preferred-script-03.js @@ -11,25 +11,28 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const FIRST_URL = EXAMPLE_URL + "code_script-switching-01.js"; const SECOND_URL = EXAMPLE_URL + "code_script-switching-02.js"; var gTab, gPanel, gDebugger; var gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: FIRST_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, FIRST_URL) - .then(() => testSource(undefined, FIRST_URL)) - .then(() => switchToSource(SECOND_URL)) + testSource(undefined, FIRST_URL); + switchToSource(SECOND_URL) .then(() => testSource(SECOND_URL)) .then(() => switchToSource(FIRST_URL)) .then(() => testSource(FIRST_URL)) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_reload-same-script.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_reload-same-script.js @@ -10,17 +10,21 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const FIRST_URL = EXAMPLE_URL + "code_script-switching-01.js"; const SECOND_URL = EXAMPLE_URL + "code_script-switching-02.js"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: FIRST_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = aPanel.panelWin; const gTarget = gDebugger.gTarget; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; @@ -74,11 +78,11 @@ function test() { break; case 5: testCurrentSource(SECOND_URL); closeDebuggerAndFinish(gPanel); break; } } - waitForSourceShown(gPanel, FIRST_URL).then(performTest); + performTest(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-01.js @@ -5,17 +5,21 @@ /** * Make sure that switching the displayed source in the UI works as advertised. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gLabel1 = "code_script-switching-01.js"; const gLabel2 = "code_script-switching-02.js"; @@ -142,17 +146,16 @@ function test() { "Editor caret location is correct. (4)"); is(gEditor.getDebugLocation(), 5, "Editor debugger location is correct. (4)"); ok(gEditor.hasLineClass(5, "debug-line"), "The debugged line is highlighted appropriately (3). (4)"); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js", 1); ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel1), "Title with first source is correct."); const shown = waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1); callInTab(gTab, "firstCall"); yield shown; yield testSourcesDisplay();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-02.js @@ -9,17 +9,21 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-02.html"; var gLabel1 = "code_script-switching-01.js"; var gLabel2 = "code_script-switching-02.js"; var gParams = "?foo=bar,baz|lol"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; function testSourcesDisplay() { let deferred = promise.defer();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-03.js @@ -5,17 +5,21 @@ /** * Make sure that the DebuggerView error loading source text is correct. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gView = gDebugger.DebuggerView; const gEditor = gDebugger.DebuggerView.editor; const gL10N = gDebugger.L10N; const require = gDebugger.require; const actions = bindActionCreators(gPanel); @@ -46,15 +50,14 @@ function test() { } function testDebuggerLoadingError() { ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText2", "")), "The valid error loading message is displayed."); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); showBogusSource(); testDebuggerLoadingError(); closeDebuggerAndFinish(gPanel); }); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-autofill-identifier.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-autofill-identifier.js @@ -7,131 +7,132 @@ * Tests that Debugger Search uses the identifier under cursor if nothing is * selected or manually passed and searching using certain operators. */ "use strict"; function test() { const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { - let Source = "code_function-search-01.js"; + let options = { + source: "code_function-search-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let Debugger = aPanel.panelWin; let Editor = Debugger.DebuggerView.editor; let Filtering = Debugger.DebuggerView.Filtering; function doSearch(aOperator) { Editor.dropSelection(); Filtering._doSearch(aOperator); } - waitForSourceShown(aPanel, Source).then(() => { - info("Testing with cursor at the beginning of the file..."); + info("Testing with cursor at the beginning of the file..."); - doSearch(); - is(Filtering._searchbox.value, "", - "The searchbox value should not be auto-filled when searching for files."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch(); + is(Filtering._searchbox.value, "", + "The searchbox value should not be auto-filled when searching for files."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("!"); - is(Filtering._searchbox.value, "!", - "The searchbox value should not be auto-filled when searching across all files."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("!"); + is(Filtering._searchbox.value, "!", + "The searchbox value should not be auto-filled when searching across all files."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("@"); - is(Filtering._searchbox.value, "@", - "The searchbox value should not be auto-filled when searching for functions."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("@"); + is(Filtering._searchbox.value, "@", + "The searchbox value should not be auto-filled when searching for functions."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("#"); - is(Filtering._searchbox.value, "#", - "The searchbox value should not be auto-filled when searching inside a file."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("#"); + is(Filtering._searchbox.value, "#", + "The searchbox value should not be auto-filled when searching inside a file."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch(":"); - is(Filtering._searchbox.value, ":", - "The searchbox value should not be auto-filled when searching for a line."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch(":"); + is(Filtering._searchbox.value, ":", + "The searchbox value should not be auto-filled when searching for a line."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("*"); - is(Filtering._searchbox.value, "*", - "The searchbox value should not be auto-filled when searching for variables."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("*"); + is(Filtering._searchbox.value, "*", + "The searchbox value should not be auto-filled when searching for variables."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - Editor.setCursor({ line: 7, ch: 0}); - info("Testing with cursor at line 8 and char 1..."); + Editor.setCursor({ line: 7, ch: 0}); + info("Testing with cursor at line 8 and char 1..."); - doSearch(); - is(Filtering._searchbox.value, "", - "The searchbox value should not be auto-filled when searching for files."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch(); + is(Filtering._searchbox.value, "", + "The searchbox value should not be auto-filled when searching for files."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("!"); - is(Filtering._searchbox.value, "!test", - "The searchbox value was incorrect when searching across all files."); - is(Filtering._searchbox.selectionStart, 1, - "The searchbox operator should not be selected"); - is(Filtering._searchbox.selectionEnd, 5, - "The searchbox contents should be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("!"); + is(Filtering._searchbox.value, "!test", + "The searchbox value was incorrect when searching across all files."); + is(Filtering._searchbox.selectionStart, 1, + "The searchbox operator should not be selected"); + is(Filtering._searchbox.selectionEnd, 5, + "The searchbox contents should be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("@"); - is(Filtering._searchbox.value, "@test", - "The searchbox value was incorrect when searching for functions."); - is(Filtering._searchbox.selectionStart, 1, - "The searchbox operator should not be selected"); - is(Filtering._searchbox.selectionEnd, 5, - "The searchbox contents should be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("@"); + is(Filtering._searchbox.value, "@test", + "The searchbox value was incorrect when searching for functions."); + is(Filtering._searchbox.selectionStart, 1, + "The searchbox operator should not be selected"); + is(Filtering._searchbox.selectionEnd, 5, + "The searchbox contents should be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("#"); - is(Filtering._searchbox.value, "#test", - "The searchbox value should be auto-filled when searching inside a file."); - is(Filtering._searchbox.selectionStart, 1, - "The searchbox operator should not be selected"); - is(Filtering._searchbox.selectionEnd, 5, - "The searchbox contents should be selected"); - is(Editor.getSelection(), "test", - "The selection in the editor should be 'test'."); + doSearch("#"); + is(Filtering._searchbox.value, "#test", + "The searchbox value should be auto-filled when searching inside a file."); + is(Filtering._searchbox.selectionStart, 1, + "The searchbox operator should not be selected"); + is(Filtering._searchbox.selectionEnd, 5, + "The searchbox contents should be selected"); + is(Editor.getSelection(), "test", + "The selection in the editor should be 'test'."); - doSearch(":"); - is(Filtering._searchbox.value, ":", - "The searchbox value should not be auto-filled when searching for a line."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch(":"); + is(Filtering._searchbox.value, ":", + "The searchbox value should not be auto-filled when searching for a line."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - doSearch("*"); - is(Filtering._searchbox.value, "*", - "The searchbox value should not be auto-filled when searching for variables."); - is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, - "The searchbox contents should not be selected"); - is(Editor.getSelection(), "", - "The selection in the editor should be empty."); + doSearch("*"); + is(Filtering._searchbox.value, "*", + "The searchbox value should not be auto-filled when searching for variables."); + is(Filtering._searchbox.selectionStart, Filtering._searchbox.selectionEnd, + "The searchbox contents should not be selected"); + is(Editor.getSelection(), "", + "The selection in the editor should be empty."); - closeDebuggerAndFinish(aPanel); - }); + closeDebuggerAndFinish(aPanel); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-01.js @@ -8,26 +8,30 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gFiltering, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gFiltering = gDebugger.DebuggerView.Filtering; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - waitForSourceShown(gPanel, ".html").then(performTest); + performTest(); }); } function performTest() { // Make sure that the search box becomes focused when pressing ctrl+f - Bug 1211038 gEditor.focus(); synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey")); let focusedEl = Services.focus.focusedElement;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-02.js @@ -8,24 +8,29 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gSources, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1, + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1) + // Calling `firstCall` is going to break into the other script + waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6) .then(performSimpleSearch) .then(() => verifySourceAndCaret("-01.js", 1, 1, [1, 1])) .then(combineWithLineSearch) .then(() => verifySourceAndCaret("-01.js", 2, 1, [53, 53])) .then(combineWithTokenSearch) .then(() => verifySourceAndCaret("-01.js", 2, 48, [96, 100])) .then(combineWithTokenColonSearch) .then(() => verifySourceAndCaret("-01.js", 2, 11, [56, 63]))
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-03.js @@ -7,24 +7,29 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gSources, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1, + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1) + // Calling `firstCall` is going to break into the other script + waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6) .then(performFileSearch) .then(escapeAndHide) .then(escapeAndClear) .then(() => verifySourceAndCaret("-01.js", 1, 1)) .then(performFunctionSearch) .then(escapeAndHide) .then(escapeAndClear) .then(() => verifySourceAndCaret("-01.js", 4, 10))
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-basic-04.js @@ -9,31 +9,31 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1, + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - waitForSourceShown(gPanel, "-01.js") - .then(testLineSearch) - .then(testTokenSearch) - .then(() => closeDebuggerAndFinish(gPanel)) - .then(null, aError => { - ok(false, "Got an error: " + aError.message + "\n" + aError.stack); - }); + testLineSearch(); + testTokenSearch(); + closeDebuggerAndFinish(gPanel); }); } function testLineSearch() { setText(gSearchBox, ":42"); ok(isCaretPos(gPanel, 7), "The editor caret position appears to be correct (1.1)."); ok(isEditorSel(gPanel, [151, 151]),
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-01.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchView, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchView = gDebugger.DebuggerView.GlobalSearch; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-02.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchView, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchView = gDebugger.DebuggerView.GlobalSearch; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-03.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchView, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchView = gDebugger.DebuggerView.GlobalSearch; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-04.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchView, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchView = gDebugger.DebuggerView.GlobalSearch; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-05.js @@ -10,17 +10,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchView, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchView = gDebugger.DebuggerView.GlobalSearch; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-06.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchView, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchView = gDebugger.DebuggerView.GlobalSearch; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-popup-jank.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-popup-jank.js @@ -8,27 +8,30 @@ */ const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; var gTab, gPanel, gDebugger; var gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; gDebugger.DebuggerView.Filtering.FilteredSources._autoSelectFirstItem = false; gDebugger.DebuggerView.Filtering.FilteredFunctions._autoSelectFirstItem = false; - waitForSourceShown(gPanel, "-01.js") - .then(superGenericFileSearch) + superGenericFileSearch() .then(() => ensureSourceIs(aPanel, "-01.js")) .then(() => ensureCaretAt(aPanel, 1)) .then(superAccurateFileSearch) .then(() => ensureSourceIs(aPanel, "-01.js")) .then(() => ensureCaretAt(aPanel, 1)) .then(() => pressKeyToHide("RETURN")) .then(() => ensureSourceIs(aPanel, "code_test-editor-mode", true))
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js @@ -8,29 +8,31 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(3); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const gSearchView = gDebugger.DebuggerView.Filtering.FilteredSources; const gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; Task.spawn(function* () { // move searches to yields // not sure what to do with the error... - - yield waitForSourceShown(gPanel, "-01.js"); yield bogusSearch(); yield firstSearch(); yield secondSearch(); yield thirdSearch(); yield fourthSearch(); yield fifthSearch(); yield sixthSearch(); yield seventhSearch();
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-02.js @@ -11,27 +11,30 @@ const TAB_URL = EXAMPLE_URL + "doc_edito var gTab, gPanel, gDebugger; var gSources, gSourceUtils, gSearchView, gSearchBox; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(3); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gSourceUtils = gDebugger.SourceUtils; gSearchView = gDebugger.DebuggerView.Filtering.FilteredSources; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - waitForSourceShown(gPanel, "-01.js") - .then(firstSearch) + firstSearch() .then(secondSearch) .then(thirdSearch) .then(fourthSearch) .then(fifthSearch) .then(goDown) .then(goDownAndWrap) .then(goUpAndWrap) .then(goUp)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js @@ -8,25 +8,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; var gTab, gPanel, gDebugger; var gSources, gSearchBox; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - waitForSourceShown(gPanel, "-01.js") - .then(superGenericSearch) + superGenericSearch() .then(verifySourcesPane) .then(kindaInterpretableSearch) .then(verifySourcesPane) .then(incrediblySpecificSearch) .then(verifySourcesPane) .then(returnAndHide) .then(verifySourcesPane) .then(() => closeDebuggerAndFinish(gPanel))
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-symbols.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-symbols.js @@ -8,27 +8,30 @@ */ const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gSearchBox, gFilteredFunctions; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; gFilteredFunctions = gDebugger.DebuggerView.Filtering.FilteredFunctions; - waitForSourceShown(gPanel, "-01.js") - .then(() => showSource("doc_function-search.html")) + showSource("doc_function-search.html") .then(htmlSearch) .then(() => showSource("code_function-search-01.js")) .then(firstJsSearch) .then(() => showSource("code_function-search-02.js")) .then(secondJsSearch) .then(() => showSource("code_function-search-03.js")) .then(thirdJsSearch) .then(saveSearch)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_searchbox-help-popup-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_searchbox-help-popup-01.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gSearchBox, gSearchBoxPanel; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; gSearchBoxPanel = gDebugger.DebuggerView.Filtering._searchboxHelpPanel; waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1) .then(showPopup)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_searchbox-help-popup-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_searchbox-help-popup-02.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSearchBox, gSearchBoxPanel; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; gSearchBoxPanel = gDebugger.DebuggerView.Filtering._searchboxHelpPanel; once(gSearchBoxPanel, "popupshown").then(() => {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_searchbox-parse.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_searchbox-parse.js @@ -3,17 +3,17 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Tests that text entered in the debugger's searchbox is properly parsed. */ function test() { - initDebugger("about:blank").then(([aTab,, aPanel]) => { + initDebugger().then(([aTab,, aPanel]) => { let filterView = aPanel.panelWin.DebuggerView.Filtering; let searchbox = aPanel.panelWin.DebuggerView.Filtering._searchbox; setText(searchbox, ""); is(filterView.searchData.toSource(), '["", [""]]', "The searchbox data wasn't parsed correctly (1)."); setText(searchbox, "#token");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-01.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { // Linux debug test slaves are a bit slow at this test sometimes. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); @@ -161,17 +165,20 @@ function test() { "There should be a selected source in the sources pane."); ok(gSources._selectedBreakpoint, "There should be a selected breakpoint in the sources pane."); is(gSources._conditionalPopupVisible, false, "The breakpoint conditional expression popup should not be shown."); }); Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; + yield addBreakpoints(); is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(queries.getSourceCount(getState()), 1, "Found the expected number of sources."); is(gEditor.getText().indexOf("ermahgerd"), 253, "The correct source was loaded initially."); @@ -202,12 +209,10 @@ function test() { // expression to the server which pauses the server. Make sure // we wait if there is a pending request. if (gDebugger.gThreadClient.state === "paused") { yield waitForThreadEvents(gPanel, "resumed"); } closeDebuggerAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-02.js @@ -5,17 +5,21 @@ /** * Test adding and modifying conditional breakpoints (with server-side support) */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); @@ -118,17 +122,19 @@ function test() { function waitForConditionUpdate() { // This will close the popup and send another request to update // the condition gSources._hideConditionalPopup(); return waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(queries.getSourceCount(getState()), 1, "Found the expected number of sources."); is(gEditor.getText().indexOf("ermahgerd"), 253, "The correct source was loaded initially."); is(gSources.selectedValue, gSources.values[0], @@ -187,12 +193,10 @@ function test() { clickOnBreakpoint(2); is(gSources._selectedBreakpoint.location.line, 20, "The selected breakpoint is line 20"); testBreakpoint(20, true, "bamboocha"); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-03.js @@ -6,17 +6,21 @@ /** * Test that conditional breakpoints survive disabled breakpoints * (with server-side support) */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; @@ -24,17 +28,20 @@ function test() { function waitForConditionUpdate() { // This will close the popup and send another request to update // the condition gSources._hideConditionalPopup(); return waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; + const location = { actor: gSources.selectedValue, line: 18 }; yield actions.addBreakpoint(location, "hello"); yield actions.disableBreakpoint(location); yield actions.addBreakpoint(location); const bp = queries.getBreakpoint(getState(), location); is(bp.condition, "hello", "The conditional expression is correct."); @@ -57,12 +64,10 @@ function test() { EventUtils.sendMouseEvent({ type: "click" }, gDebugger.document.querySelector(".dbg-breakpoint"), gDebugger); yield finished; is(textbox.value, "foo", "The expression is correct (3)."); yield resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-04.js @@ -7,35 +7,40 @@ * Make sure that conditional breakpoints with undefined expressions * maintain their conditions when re-enabling them (with * server-side support) */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; + const location = { actor: gSources.selectedValue, line: 18 }; yield actions.addBreakpoint(location, ""); yield actions.disableBreakpoint(location); yield actions.addBreakpoint(location); const bp = queries.getBreakpoint(getState(), location); is(bp.condition, "", "The conditional expression is correct."); resumeDebuggerThenCloseAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_server-conditional-bp-05.js @@ -6,17 +6,21 @@ /** * Test conditional breakpoints throwing exceptions * with server support */ const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + const options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const queries = gDebugger.require("./content/queries"); const constants = gDebugger.require("./content/constants"); const actions = bindActionCreators(gPanel); @@ -90,17 +94,19 @@ function test() { isnot(selectedBreakpoint.condition, undefined, "The breakpoint on line " + line + " should have a conditional expression."); ok(isCaretPos(gPanel, line), "The editor caret position is not properly set."); } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 17); + let onCaretUpdated = waitForCaretAndScopes(gPanel, 17); + callInTab(gTab, "ermahgerd"); + yield onCaretUpdated; yield actions.addBreakpoint( { actor: gSources.selectedValue, line: 18 }, " 1a" ); yield actions.addBreakpoint( { actor: gSources.selectedValue, line: 19 }, "new Error()" ); yield actions.addBreakpoint( @@ -119,12 +125,10 @@ function test() { yield resumeAndTestBreakpoint(18); yield resumeAndTestBreakpoint(19); yield resumeAndTestBreakpoint(20); yield resumeAndTestBreakpoint(23); yield resumeAndTestNoBreakpoint(); closeDebuggerAndFinish(gPanel); }); - - callInTab(gTab, "ermahgerd"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-01.js @@ -10,28 +10,31 @@ const TAB_URL = EXAMPLE_URL + "doc_binary_search.html"; const COFFEE_URL = EXAMPLE_URL + "code_binary_search.coffee"; var gTab, gPanel, gDebugger; var gEditor, gSources; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: COFFEE_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; checkSourceMapsEnabled(); - waitForSourceShown(gPanel, ".coffee") - .then(checkInitialSource) - .then(testSetBreakpoint) + checkInitialSource(); + testSetBreakpoint() .then(testSetBreakpointBlankLine) .then(testHitBreakpoint) .then(testStepping) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-02.js @@ -9,28 +9,31 @@ const TAB_URL = EXAMPLE_URL + "doc_binary_search.html"; const JS_URL = EXAMPLE_URL + "code_binary_search.js"; var gTab, gPanel, gDebugger, gEditor; var gSources, gFrames, gPrefs, gOptions; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: ".coffee", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; - waitForSourceShown(gPanel, ".coffee") - .then(testToggleGeneratedSource) + testToggleGeneratedSource() .then(testSetBreakpoint) .then(testToggleOnPause) .then(testResume) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-03.js @@ -9,27 +9,30 @@ const TAB_URL = EXAMPLE_URL + "doc_minified.html"; const JS_URL = EXAMPLE_URL + "code_math.js"; var gTab, gPanel, gDebugger; var gEditor, gSources, gFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: JS_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; - waitForSourceShown(gPanel, JS_URL) - .then(checkInitialSource) - .then(testSetBreakpoint) + checkInitialSource() + testSetBreakpoint() .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); } function checkInitialSource() {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_source-maps-04.js @@ -12,32 +12,35 @@ const JS_URL = EXAMPLE_URL + "code_math_ // This test causes an error to be logged in the console, which appears in TBPL // logs, so we are disabling that here. DevToolsUtils.reportingDisabled = true; var gPanel, gDebugger, gFrames, gSources, gPrefs, gOptions; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: JS_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gSources = gDebugger.DebuggerView.Sources; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; is(gPrefs.pauseOnExceptions, false, "The pause-on-exceptions pref should be disabled by default."); isnot(gOptions._pauseOnExceptionsItem.getAttribute("checked"), "true", "The pause-on-exceptions menu item should not be checked."); - waitForSourceShown(gPanel, JS_URL) - .then(checkInitialSource) - .then(enablePauseOnExceptions) + checkInitialSource(); + enablePauseOnExceptions() .then(disableIgnoreCaughtExceptions) .then(testSetBreakpoint) .then(reloadPage) .then(testHitBreakpoint) .then(enableIgnoreCaughtExceptions) .then(disablePauseOnExceptions) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-bookmarklet.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-bookmarklet.js @@ -7,30 +7,32 @@ * Make sure javascript bookmarklet scripts appear and load correctly in the source list */ const TAB_URL = EXAMPLE_URL + "doc_script-bookmarklet.html"; const BOOKMARKLET_SCRIPT_CODE = "console.log('bookmarklet executed');"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const gBreakpoints = gDebugger.DebuggerController.Breakpoints; const getState = gDebugger.DebuggerController.getState; const constants = gDebugger.require("./content/constants"); const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); return Task.spawn(function* () { - yield waitForSourceShown(gPanel, ".html"); - const added = waitForNextDispatch(gDebugger.DebuggerController, constants.ADD_SOURCE); // NOTE: devtools debugger panel needs to be already open, // or the bookmarklet script will not be shown in the sources panel callInTab(gTab, "injectBookmarklet", BOOKMARKLET_SCRIPT_CODE); yield added; is(queries.getSourceCount(getState()), 2, "Should have 2 sources");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-cache.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-cache.js @@ -6,17 +6,21 @@ /** * Tests if the sources cache knows how to cache sources when prompted. */ const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; const TOTAL_SOURCES = 4; function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { const gTab = aTab; const gDebuggee = aDebuggee; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gPrevLabelsCache = gDebugger.SourceUtils._labelsCache; const gPrevGroupsCache = gDebugger.SourceUtils._groupsCache; @@ -122,17 +126,16 @@ function test() { "There should be " + TOTAL_SOURCES + " sources present in the sources list."); is(gDebugger.SourceUtils._labelsCache.size, TOTAL_SOURCES, "There should be " + TOTAL_SOURCES + " labels cached after reload."); is(gDebugger.SourceUtils._groupsCache.size, TOTAL_SOURCES, "There should be " + TOTAL_SOURCES + " groups cached after reload."); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); yield initialChecks(); yield testCacheIntegrity(["code_function-search-01.js"]); yield fetchAllSources(); yield testCacheIntegrity([ "code_function-search-01.js", "code_function-search-02.js", "code_function-search-03.js", "doc_function-search.html"
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-contextmenu-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-contextmenu-01.js @@ -8,24 +8,27 @@ */ const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; const SCRIPT_URI = EXAMPLE_URL + "code_function-search-01.js"; function test() { let gTab, gPanel, gDebugger, gSources; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: SCRIPT_URI, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, "-01.js") - .then(openContextMenu) + openContextMenu() .then(testCopyMenuItem) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); function clickCopyURL() {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-contextmenu-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-contextmenu-02.js @@ -9,24 +9,27 @@ const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; const SCRIPT_URI = EXAMPLE_URL + "code_function-search-01.js"; function test() { let gTab, gPanel, gDebugger; let gSources; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: SCRIPT_URI, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, "-01.js") - .then(openContextMenu) + openContextMenu() .then(testNewTabMenuItem) .then(testNewTabURI) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-eval-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-eval-01.js @@ -8,25 +8,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gBreakpoints; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-eval.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gBreakpoints = gDebugger.DebuggerController.Breakpoints; return Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-eval.js"); is(gSources.values.length, 1, "Should have 1 source"); let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE); callInTab(gTab, "evalSource"); yield newSource; is(gSources.values.length, 2, "Should have 2 sources");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-eval-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-eval-02.js @@ -9,30 +9,33 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gBreakpoints, gEditor; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-eval.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gBreakpoints = gDebugger.DebuggerController.Breakpoints; gEditor = gDebugger.DebuggerView.editor; const constants = gDebugger.require("./content/constants"); const queries = gDebugger.require("./content/queries"); const actions = bindActionCreators(gPanel); const getState = gDebugger.DebuggerController.getState; return Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-eval.js"); is(queries.getSourceCount(getState()), 1, "Should have 1 source"); const newSource = waitForDispatch(gPanel, constants.ADD_SOURCE); callInTab(gTab, "evalSourceWithSourceURL"); yield newSource; is(queries.getSourceCount(getState()), 2, "Should have 2 sources");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-iframe-reload.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-iframe-reload.js @@ -10,17 +10,17 @@ "use strict"; const IFRAME_URL = "data:text/html;charset=utf-8," + "<script>function fn() { console.log('hello'); }</script>" + "<div onclick='fn()'>hello</div>"; const TAB_URL = `data:text/html;charset=utf-8,<iframe src="${IFRAME_URL}"/>`; add_task(function* () { - let [,, panel] = yield initDebugger("about:blank"); + let [,, panel] = yield initDebugger(); let dbg = panel.panelWin; let newSource; newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE); reload(panel, TAB_URL); yield newSource; ok(true, "Source event fired on initial load");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-keybindings.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-keybindings.js @@ -8,24 +8,27 @@ */ const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; const SCRIPT_URI = EXAMPLE_URL + "code_function-search-01.js"; function test() { let gTab, gPanel, gDebugger, gSources; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: SCRIPT_URI, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - waitForSourceShown(gPanel, "-01.js") - .then(testCopyURLShortcut) + testCopyURLShortcut() .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); function testCopyURLShortcut() { return waitForClipboardPromise(sendCopyShortcut, SCRIPT_URI);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-labels.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-labels.js @@ -8,28 +8,30 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { let gTab, gPanel, gDebugger; let gSources, gUtils; - initDebugger(TAB_URL).then(Task.async(function* ([aTab,, aPanel]) { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(Task.async(function* ([aTab,, aPanel]) { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gUtils = gDebugger.SourceUtils; let ellipsis = gPanel.panelWin.L10N.ellipsis; let nananana = new Array(20).join(NaN); - yield waitForSourceShown(gPanel, ".html"); - // Test trimming url queries. let someUrl = "a/b/c.d?test=1&random=4#reference"; let shortenedUrl = "a/b/c.d"; is(gUtils.trimUrlQuery(someUrl), shortenedUrl, "Trimming the url query isn't done properly."); // Test trimming long urls with an ellipsis.
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js @@ -7,17 +7,21 @@ * Tests that large files are treated differently in the debugger: * 1) No parsing to determine current symbol is attempted when * starting a search */ const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { const gTab = aTab; const gDebuggee = aDebuggee; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const Filtering = gDebugger.DebuggerView.Filtering; @@ -54,17 +58,16 @@ function test() { gEditor.focus(); gEditor.setCursor({ line: 3, ch: 10}); synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey")); is(Filtering._searchbox.value, "#test", "Search box is prefilled with current token"); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, "-01.js"); yield testLargeFile(); info("Making it appear as a small file and then reselecting 01.js"); gDebugger.DebuggerView.LARGE_FILE_SIZE = 1000; gSources.selectedIndex = 1; yield waitForSourceShown(gPanel, "-02.js"); gSources.selectedIndex = 0; yield waitForSourceShown(gPanel, "-01.js");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-sorting.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-sorting.js @@ -8,28 +8,31 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gSources, gUtils; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; gUtils = gDebugger.SourceUtils; - waitForSourceShown(gPanel, ".html") - .then(addSourceAndCheckOrder.bind(null, 1)) - .then(addSourceAndCheckOrder.bind(null, 2)) - .then(addSourceAndCheckOrder.bind(null, 3)) - .then(() => { closeDebuggerAndFinish(gPanel); }); + addSourceAndCheckOrder(1); + addSourceAndCheckOrder(2); + addSourceAndCheckOrder(3); + closeDebuggerAndFinish(gPanel); }); } function addSourceAndCheckOrder(aMethod) { gSources.empty(); gSources.suppressSelectionEvents = true; let urls = [
--- a/devtools/client/debugger/test/mochitest/browser_dbg_sources-webext-contentscript.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-webext-contentscript.js @@ -25,26 +25,24 @@ function test() { // If no debugger panel was opened, call finish directly. finish(); } }; return Task.spawn(function* () { gAddon = yield addAddon(EXAMPLE_URL + "/addon-webext-contentscript.xpi"); - [,, gPanel] = yield initDebugger(TAB_URL); + let options = { + source: "webext-content-script.js", + line: 1 + }; + [,, gPanel] = yield initDebugger(TAB_URL, options); gDebugger = gPanel.panelWin; gSources = gDebugger.DebuggerView.Sources; - // Wait for a SOURCE_SHOWN event for at most 4 seconds. - yield Promise.race([ - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN), - waitForTime(4000), - ]); - is(gSources.values.length, 1, "Should have 1 source"); let item = gSources.getItemForAttachment(attachment => { return attachment.source.url.includes("moz-extension"); }); ok(item, "Got the expected WebExtensions ContentScript source"); ok(item && item.attachment.source.url.includes(item.attachment.group),
--- a/devtools/client/debugger/test/mochitest/browser_dbg_split-console-keypress.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_split-console-keypress.js @@ -11,23 +11,27 @@ const TAB_URL = EXAMPLE_URL + "doc_step- function test() { // This does the same assertions over a series of sub-tests, and it // can timeout in linux e10s. No sense in breaking it up into multiple // tests, so request extra time. requestLongerTimeout(2); let gDebugger, gToolbox, gThreadClient, gTab, gPanel; - initDebugger(TAB_URL).then(([aTab, debuggeeWin, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, debuggeeWin, aPanel]) => { gPanel = aPanel; gDebugger = aPanel.panelWin; gToolbox = gDevTools.getToolbox(aPanel.target); gTab = aTab; gThreadClient = gDebugger.DebuggerController.activeThread; - waitForSourceShown(aPanel, TAB_URL).then(testConsole); + testConsole(); }); let testConsole = Task.async(function* () { // We need to open the split console (with an ESC keypress), // then get the script into a paused state by pressing a button in the page, // ensure focus is in the split console, // synthesize a few keys - important ones we share listener for are // "resumeKey", "stepOverKey", "stepInKey", "stepOutKey" // then check that
--- a/devtools/client/debugger/test/mochitest/browser_dbg_split-console-paused-reload.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_split-console-paused-reload.js @@ -9,23 +9,26 @@ */ function test() { Task.spawn(runTests); } function* runTests() { let TAB_URL = EXAMPLE_URL + "doc_split-console-paused-reload.html"; - let [,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [,, panel] = yield initDebugger(TAB_URL, options); let dbgWin = panel.panelWin; let sources = dbgWin.DebuggerView.Sources; let frames = dbgWin.DebuggerView.StackFrames; let toolbox = gDevTools.getToolbox(panel.target); - yield waitForSourceShown(panel, ".html"); yield panel.addBreakpoint({ actor: getSourceActor(sources, TAB_URL), line: 16 }); info("Breakpoint was set."); dbgWin.DebuggerController._target.activeTab.reload(); info("Page reloaded."); yield waitForSourceAndCaretAndScopes(panel, ".html", 16); yield ensureThreadClientState(panel, "paused"); info("Breakpoint was hit."); EventUtils.sendMouseEvent({ type: "mousedown" },
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-01.js @@ -8,24 +8,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gFrames, gClassicFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; - waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest); + waitForCaretAndScopes(gPanel, 14).then(performTest); callInTab(gTab, "simpleCall"); }); } function performTest() { is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(gFrames.itemCount, 1,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-02.js @@ -5,17 +5,21 @@ /** * Test that stackframes are added when debugger is paused in eval calls. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gFrames = gDebugger.DebuggerView.StackFrames; const gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; const performTest = Task.async(function* () { is(gDebugger.gThreadClient.state, "paused", @@ -97,15 +101,15 @@ function test() { "Oldest frame should be selected after click inside the oldest frame."); is(gClassicFrames.selectedIndex, 1, "Oldest frame in the mirrored view should be selected."); resumeDebuggerThenCloseAndFinish(gPanel); }); Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, ".html", 1); + yield waitForCaretAndScopes(gPanel, 1); performTest(); }); callInTab(gTab, "evalCall"); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-03.js @@ -6,17 +6,21 @@ /** * Test that stackframes are scrollable. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; let framesScrollingInterval; function test() { - initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { const tab = aTab; const debuggee = aDebuggee; const panel = aPanel; const gDebugger = panel.panelWin; const frames = gDebugger.DebuggerView.StackFrames; const classicFrames = gDebugger.DebuggerView.StackFramesClassicList; Task.spawn(function* () {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-04.js @@ -8,24 +8,28 @@ */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; var gFrames, gClassicFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; - waitForSourceAndCaretAndScopes(gPanel, ".html", 1).then(performTest); + waitForCaretAndScopes(gPanel, 1).then(performTest); callInTab(gTab, "evalCall"); }); } function performTest() { is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); is(gFrames.itemCount, 2,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-05.js @@ -6,17 +6,21 @@ /** * Test that switching between stack frames properly sets the current debugger * location in the source editor. */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gEditor = gDebugger.DebuggerView.editor; const gSources = gDebugger.DebuggerView.Sources; const gFrames = gDebugger.DebuggerView.StackFrames; const gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; @@ -38,17 +42,17 @@ function test() { "The second source is selected in the widget."); ok(isCaretPos(gPanel, 6), "Editor caret location is correct."); is(gEditor.getDebugLocation(), 5, "Editor debug location is correct."); } function testOldestFrame() { - const shown = waitForSourceAndCaret(gPanel, "-01.js", 1).then(() => { + const shown = waitForSourceAndCaret(gPanel, "-01.js", 5).then(() => { is(gFrames.selectedIndex, 0, "Second frame should be selected after click."); is(gClassicFrames.selectedIndex, 1, "Second frame should be selected in the mirrored view as well."); is(gSources.selectedIndex, 0, "The first source is now selected in the widget."); ok(isCaretPos(gPanel, 5), "Editor caret location is correct (3)."); @@ -80,17 +84,17 @@ function test() { }, true); gDebugger.gThreadClient.resume(); return deferred.promise; } Task.spawn(function* () { - yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1); + yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6); yield initialChecks(); yield testNewestFrame(); yield testOldestFrame(); yield testAfterResume(); closeDebuggerAndFinish(gPanel); }); callInTab(gTab, "firstCall");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-06.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gFrames, gClassicFrames; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-07.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-07.js @@ -10,17 +10,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; var gTab, gPanel, gDebugger; var gEditor, gSources, gFrames, gClassicFrames, gToolbar; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: "-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; gToolbar = gDebugger.DebuggerView.Toolbar;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-contextmenu-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-contextmenu-01.js @@ -7,17 +7,21 @@ * Test that the copy contextmenu has been added to the stack frames view. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; let gTab, gPanel, gDebugger; let gFrames, gContextMenu; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED) .then(performTest); callInTab(gTab, "simpleCall");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-contextmenu-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-contextmenu-02.js @@ -7,17 +7,21 @@ * Test that the copy contextmenu copys the stack frames to the clipboard. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; const STACK_STRING = "simpleCall@" + EXAMPLE_URL + "doc_recursion-stack.html:14:8"; function test() { let gTab, gPanel, gDebugger, gFrames; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED) .then(openContextMenu) .then(testCopyStackMenuItem)
--- a/devtools/client/debugger/test/mochitest/browser_dbg_step-out.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_step-out.js @@ -8,28 +8,32 @@ */ const TAB_URL = EXAMPLE_URL + "doc_step-out.html"; var gTab, gPanel, gDebugger; var gVars; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVars = gDebugger.DebuggerView.Variables; testNormalReturn(); }); } function testNormalReturn() { - waitForSourceAndCaretAndScopes(gPanel, ".html", 17).then(() => { + waitForCaretAndScopes(gPanel, 17).then(() => { waitForCaretAndScopes(gPanel, 20).then(() => { let innerScope = gVars.getScopeAtIndex(0); let returnVar = innerScope.get("<return>"); is(returnVar.name, "<return>", "Should have the right property name for the returned value."); is(returnVar.value, 10, "Should have the right property value for the returned value.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_terminate-on-tab-close.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_terminate-on-tab-close.js @@ -9,17 +9,21 @@ thisTestLeaksUncaughtRejectionsAndShould /** * Tests that debuggee scripts are terminated on tab closure. */ const TAB_URL = EXAMPLE_URL + "doc_terminate-on-tab-close.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; gDebugger.gThreadClient.addOneTimeListener("paused", () => { resumeDebuggerThenCloseAndFinish(gPanel).then(function () { ok(true, "should not throw after this point"); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-01.js @@ -6,17 +6,21 @@ /** * Tests that creating, collpasing and expanding scopes in the * variables view works as expected. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let variables = aPanel.panelWin.DebuggerView.Variables; let testScope = variables.addScope("test"); ok(testScope, "Should have created a scope."); ok(testScope.id.includes("test"), "The newly created scope should have the default id set."); is(testScope.name, "test",
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-02.js @@ -6,17 +6,21 @@ /** * Tests that creating, collapsing and expanding variables in the * variables view works as expected. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let variables = aPanel.panelWin.DebuggerView.Variables; let testScope = variables.addScope("test"); let testVar = testScope.addItem("something"); let duplVar = testScope.addItem("something"); info("Scope id: " + testScope.id); info("Scope name: " + testScope.name); info("Variable id: " + testVar.id);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-03.js @@ -6,17 +6,21 @@ /** * Tests that recursively creating properties in the variables view works * as expected. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let variables = aPanel.panelWin.DebuggerView.Variables; let testScope = variables.addScope("test"); is(testScope.target.querySelectorAll(".variables-view-element-details.enum").length, 1, "One enumerable container should be present in the scope."); is(testScope.target.querySelectorAll(".variables-view-element-details.nonenum").length, 1, "One non-enumerable container should be present in the scope."); is(testScope.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-04.js @@ -5,17 +5,21 @@ /** * Tests that grips are correctly applied to variables. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let variables = aPanel.panelWin.DebuggerView.Variables; let testScope = variables.addScope("test"); let testVar = testScope.addItem("something"); testVar.setGrip(1.618); is(testVar.target.querySelector(".value").getAttribute("value"), "1.618", "The grip information for the variable wasn't set correctly (1).");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-05.js @@ -5,17 +5,21 @@ /** * Tests that grips are correctly applied to variables and properties. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { let variables = aPanel.panelWin.DebuggerView.Variables; let globalScope = variables.addScope("Test-Global"); let localScope = variables.addScope("Test-Local"); ok(globalScope, "The globalScope hasn't been created correctly."); ok(localScope, "The localScope hasn't been created correctly.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-06.js @@ -5,18 +5,21 @@ /** * Test that Promises get their internal state added as psuedo properties. */ const TAB_URL = EXAMPLE_URL + "doc_promise.html"; var test = Task.async(function* () { - const [tab,, panel] = yield initDebugger(TAB_URL); - yield ensureSourceIs(panel, "doc_promise.html", true); + let options = { + source: TAB_URL, + line: 1 + }; + const [tab,, panel] = yield initDebugger(TAB_URL, options); const scopes = waitForCaretAndScopes(panel, 21); callInTab(tab, "doPause"); yield scopes; const variables = panel.panelWin.DebuggerView.Variables; ok(variables, "Should get the variables view.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-accessibility.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-accessibility.js @@ -6,17 +6,17 @@ /** * Make sure that the variables view is keyboard accessible. */ var gTab, gPanel, gDebugger; var gVariablesView; function test() { - initDebugger("about:blank").then(([aTab,, aPanel]) => { + initDebugger().then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariablesView = gDebugger.DebuggerView.Variables; performTest().then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-data.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-data.js @@ -7,17 +7,17 @@ * Make sure that the variables view correctly populates itself * when given some raw data. */ var gTab, gPanel, gDebugger; var gVariablesView, gScope, gVariable; function test() { - initDebugger("about:blank").then(([aTab,, aPanel]) => { + initDebugger().then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariablesView = gDebugger.DebuggerView.Variables; performTest(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js @@ -7,17 +7,21 @@ * Make sure that canceling a name change correctly unhides the separator and * value elements. */ const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let vars = win.DebuggerView.Variables; win.DebuggerView.WatchExpressions.addExpression("this"); callInTab(tab, "ermahgerd"); yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-click.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-click.js @@ -7,17 +7,21 @@ * Check that the editing state of a Variable is correctly tracked. Clicking on * the textbox while editing should not cancel editing. */ const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; function test() { Task.spawn(function* () { - let [tab, debuggee, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab, debuggee, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let vars = win.DebuggerView.Variables; win.DebuggerView.WatchExpressions.addExpression("this"); // Allow this generator function to yield first. executeSoon(() => debuggee.ermahgerd()); yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-getset-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-getset-01.js @@ -11,29 +11,33 @@ const TAB_URL = EXAMPLE_URL + "doc_frame var gTab, gPanel, gDebugger; var gL10N, gEditor, gVars, gWatch; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gL10N = gDebugger.L10N; gEditor = gDebugger.DebuggerView.editor; gVars = gDebugger.DebuggerView.Variables; gWatch = gDebugger.DebuggerView.WatchExpressions; gVars.switch = function () {}; gVars.delete = function () {}; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(() => addWatchExpressions()) .then(() => testEdit("set", "this._prop = value + ' BEER CAN'", { "myVar.prop": "xlerb BEER CAN", "myVar.prop + 42": "xlerb BEER CAN42", "myVar.prop = 'xlerb'": "xlerb" })) .then(() => testEdit("set", "{ this._prop = value + ' BEACON' }", { "myVar.prop": "xlerb BEACON",
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-getset-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-getset-02.js @@ -12,29 +12,33 @@ const TAB_URL = EXAMPLE_URL + "doc_frame var gTab, gPanel, gDebugger; var gL10N, gEditor, gVars, gWatch; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gL10N = gDebugger.L10N; gEditor = gDebugger.DebuggerView.editor; gVars = gDebugger.DebuggerView.Variables; gWatch = gDebugger.DebuggerView.WatchExpressions; gVars.switch = function () {}; gVars.delete = function () {}; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(() => addWatchExpression()) .then(() => testEdit("\"xlerb\"", "xlerb")) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); generateMouseClickInTab(gTab, "content.document.querySelector('button')");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-value.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-value.js @@ -8,23 +8,27 @@ */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; var gTab, gPanel, gDebugger; var gVars; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVars = gDebugger.DebuggerView.Variables; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(() => initialChecks()) .then(() => testModification("a", "1")) .then(() => testModification("{ a: 1 }", "Object")) .then(() => testModification("[a]", "Array[1]")) .then(() => testModification("b", "Object")) .then(() => testModification("b.a", "1")) .then(() => testModification("c.a", "1")) .then(() => testModification("Infinity", "Infinity"))
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-watch.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-watch.js @@ -8,26 +8,32 @@ */ const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; var gTab, gPanel, gDebugger; var gL10N, gEditor, gVars, gWatch; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gL10N = gDebugger.L10N; gEditor = gDebugger.DebuggerView.editor; gVars = gDebugger.DebuggerView.Variables; gWatch = gDebugger.DebuggerView.WatchExpressions; - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS) + promise.all([ + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS), + waitForCaretAndScopes(gPanel, 18)]) .then(() => testInitialVariablesInScope()) .then(() => testInitialExpressionsInScope()) .then(() => testModification("document.title = 42", "document.title = 43", "43", "undefined")) .then(() => testIntegrity1()) .then(() => testModification("aArg", "aArg = 44", "44", "44")) .then(() => testIntegrity2()) .then(() => testModification("aArg = 44", "\ \t\r\ndocument.title\ \t\r\n", "\"43\"", "44")) .then(() => testIntegrity3())
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-01.js @@ -11,30 +11,33 @@ const TAB_URL = EXAMPLE_URL + "doc_with- var gTab, gPanel, gDebugger; var gVariables, gSearchBox; function test() { // Debug test slaves are quite slow at this test. requestLongerTimeout(4); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; gVariables._enableSearch(); gSearchBox = gVariables._searchboxNode; // The first 'with' scope should be expanded by default, but the // variables haven't been fetched yet. This is how 'with' scopes work. promise.all([ - waitForSourceAndCaret(gPanel, ".html", 22), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForCaretAndScopes(gPanel, 22), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) ]).then(prepareVariablesAndProperties) .then(testVariablesAndPropertiesFiltering) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-02.js @@ -11,30 +11,33 @@ const TAB_URL = EXAMPLE_URL + "doc_with- var gTab, gPanel, gDebugger; var gVariables, gSearchBox; function test() { // Debug test slaves are quite slow at this test. requestLongerTimeout(4); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; gVariables._enableSearch(); gSearchBox = gVariables._searchboxNode; // The first 'with' scope should be expanded by default, but the // variables haven't been fetched yet. This is how 'with' scopes work. promise.all([ - waitForSourceAndCaret(gPanel, ".html", 22), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForCaretAndScopes(gPanel, 22), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) ]).then(prepareVariablesAndProperties) .then(testVariablesAndPropertiesFiltering) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-03.js @@ -12,28 +12,31 @@ const TAB_URL = EXAMPLE_URL + "doc_with- var gTab, gPanel, gDebugger; var gVariables, gSearchBox; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; // The first 'with' scope should be expanded by default, but the // variables haven't been fetched yet. This is how 'with' scopes work. promise.all([ - waitForSourceAndCaret(gPanel, ".html", 22), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForCaretAndScopes(gPanel, 22), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) ]).then(prepareVariablesAndProperties) .then(testVariablesAndPropertiesFiltering) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-04.js @@ -12,29 +12,32 @@ const TAB_URL = EXAMPLE_URL + "doc_with- var gTab, gPanel, gDebugger; var gEditor, gVariables, gSearchBox; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gVariables = gDebugger.DebuggerView.Variables; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; // The first 'with' scope should be expanded by default, but the // variables haven't been fetched yet. This is how 'with' scopes work. promise.all([ - waitForSourceAndCaret(gPanel, ".html", 22), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForCaretAndScopes(gPanel, 22), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) ]).then(prepareVariablesAndProperties) .then(testVariablesAndPropertiesFiltering) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-05.js @@ -12,28 +12,31 @@ const TAB_URL = EXAMPLE_URL + "doc_with- var gTab, gPanel, gDebugger; var gVariables, gSearchBox; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; // The first 'with' scope should be expanded by default, but the // variables haven't been fetched yet. This is how 'with' scopes work. promise.all([ - waitForSourceAndCaret(gPanel, ".html", 22), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForCaretAndScopes(gPanel, 22), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) ]).then(prepareVariablesAndProperties) .then(testVariablesAndPropertiesFiltering) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-pref.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-pref.js @@ -8,25 +8,29 @@ */ const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; var gTab, gPanel, gDebugger; var gPrefs, gOptions, gVariables; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; gVariables = gDebugger.DebuggerView.Variables; - waitForSourceShown(gPanel, ".html").then(performTest); + performTest(); }); } function performTest() { ok(!gVariables._searchboxNode, "There should not initially be a searchbox available in the variables view."); ok(!gVariables._searchboxContainer, "There should not initially be a searchbox container available in the variables view.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-searchbox.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-filter-searchbox.js @@ -9,23 +9,27 @@ */ const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; var gTab, gPanel, gDebugger; var gVariables; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; - waitForSourceShown(gPanel, ".html").then(performTest); + performTest(); }); } function performTest() { // Step 1: the searchbox shouldn't initially be shown. ok(!gVariables._searchboxNode, "There should not initially be a searchbox available in the variables view.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-parameters-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-parameters-01.js @@ -12,23 +12,27 @@ const TAB_URL = EXAMPLE_URL + "doc_frame var gTab, gPanel, gDebugger; var gVariables; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(initialChecks) .then(testExpandVariables) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); generateMouseClickInTab(gTab, "content.document.querySelector('button')");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-parameters-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-parameters-02.js @@ -12,23 +12,27 @@ const TAB_URL = EXAMPLE_URL + "doc_frame var gTab, gPanel, gDebugger; var gVariables; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(testScopeVariables) .then(testArgumentsProperties) .then(testSimpleObject) .then(testComplexObject) .then(testArgumentObject) .then(testInnerArgumentObject) .then(testGetterSetterObject) .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-parameters-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-parameters-03.js @@ -12,23 +12,27 @@ const TAB_URL = EXAMPLE_URL + "doc_frame var gTab, gPanel, gDebugger; var gVariables; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(expandGlobalScope) .then(testGlobalScope) .then(expandWindowVariable) .then(testWindowVariable) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-with.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frame-with.js @@ -8,27 +8,30 @@ */ const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; var gTab, gPanel, gDebugger; var gVariables; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; // The first 'with' scope should be expanded by default, but the // variables haven't been fetched yet. This is how 'with' scopes work. promise.all([ - waitForSourceAndCaret(gPanel, ".html", 22), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForCaretAndScopes(gPanel, 22), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) ]).then(testFirstWithScope) .then(expandSecondWithScope) .then(testSecondWithScope) .then(expandFunctionScope) .then(testFunctionScope) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frozen-sealed-nonext.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-frozen-sealed-nonext.js @@ -8,17 +8,21 @@ * attributes on variables so that the F/S/N is shown in the variables view. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; var gTab, gPanel, gDebugger; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; prepareTest(); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-hide-non-enums.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-hide-non-enums.js @@ -8,22 +8,26 @@ * in the variables view. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; var gTab, gPanel, gDebugger; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; - waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest); + waitForCaretAndScopes(gPanel, 14).then(performTest); callInTab(gTab, "simpleCall"); }); } function performTest() { let testScope = gDebugger.DebuggerView.Variables.addScope("test-scope"); let testVar = testScope.addItem("foo");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-large-array-buffer.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-large-array-buffer.js @@ -14,24 +14,28 @@ const TAB_URL = EXAMPLE_URL + "doc_large var gTab, gPanel, gDebugger; var gVariables, gEllipsis; function test() { // this test does a lot of work on large objects, default 45s is not enough requestLongerTimeout(4); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; gEllipsis = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data; - waitForSourceAndCaretAndScopes(gPanel, ".html", 28) + waitForCaretAndScopes(gPanel, 28, 1) .then(() => performTests()) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, error => { ok(false, "Got an error: " + error.message + "\n" + error.stack); }); generateMouseClickInTab(gTab, "content.document.querySelector('button')"); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-map-set.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-map-set.js @@ -7,18 +7,21 @@ * Test that Map and Set and their Weak friends are displayed in variables view. */ "use strict"; const TAB_URL = EXAMPLE_URL + "doc_map-set.html"; var test = Task.async(function* () { - const [tab,, panel] = yield initDebugger(TAB_URL); - yield ensureSourceIs(panel, "doc_map-set.html", true); + let options = { + source: TAB_URL, + line: 1 + }; + const [tab,, panel] = yield initDebugger(TAB_URL, options); const scopes = waitForCaretAndScopes(panel, 37); callInTab(tab, "startTest"); yield scopes; const variables = panel.panelWin.DebuggerView.Variables; ok(variables, "Should get the variables view.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-override-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-override-01.js @@ -5,23 +5,27 @@ * Tests that VariablesView methods responsible for styling variables * as overridden work properly. */ const TAB_URL = EXAMPLE_URL + "doc_scope-variable-2.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let variables = win.DebuggerView.Variables; callInTab(tab, "test"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 23); + yield waitForCaretAndScopes(panel, 23); let firstScope = variables.getScopeAtIndex(0); let secondScope = variables.getScopeAtIndex(1); let thirdScope = variables.getScopeAtIndex(2); let globalLexicalScope = variables.getScopeAtIndex(3); let globalScope = variables.getScopeAtIndex(4); ok(firstScope, "The first scope is available.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-override-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-override-02.js @@ -6,27 +6,33 @@ /** * Tests that overridden variables in the VariablesView are styled properly. */ const TAB_URL = EXAMPLE_URL + "doc_scope-variable-2.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let variables = win.DebuggerView.Variables; // Wait for the hierarchy to be committed by the VariablesViewController. let committedLocalScopeHierarchy = promise.defer(); variables.oncommit = committedLocalScopeHierarchy.resolve; + + let onCaretAndScopes = waitForCaretAndScopes(panel, 23); callInTab(tab, "test"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 23); + yield onCaretAndScopes; yield committedLocalScopeHierarchy.promise; let firstScope = variables.getScopeAtIndex(0); let secondScope = variables.getScopeAtIndex(1); let thirdScope = variables.getScopeAtIndex(2); let someVar1 = firstScope.get("a"); let argsVar1 = firstScope.get("arguments");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-01.js @@ -7,17 +7,21 @@ * Tests opening the variable inspection popup on a variable which has a * simple literal as the value. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; bubble._ignoreLiterals = false; function verifyContents(textContent, className) { is(tooltip.querySelectorAll(".variables-view-container").length, 0, @@ -26,18 +30,20 @@ function test() { "There should be a simple text node added to the tooltip instead."); is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent, "The inspected property's value is correct."); ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.includes(className), "The inspected property's value is colorized correctly."); } + + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect variables. yield openVarPopup(panel, { line: 15, ch: 12 }); verifyContents("1", "token-number"); yield reopenVarPopup(panel, { line: 16, ch: 21 }); verifyContents("1", "token-number");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-02.js @@ -7,35 +7,41 @@ * Tests opening the variable inspection popup on a variable which has a * a property accessible via getters and setters. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; function verifyContents(textContent, className) { is(tooltip.querySelectorAll(".variables-view-container").length, 0, "There should be no variables view containers added to the tooltip."); is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1, "There should be a simple text node added to the tooltip instead."); is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent, "The inspected property's value is correct."); ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.includes(className), "The inspected property's value is colorized correctly."); } + + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect properties. yield openVarPopup(panel, { line: 19, ch: 10 }); verifyContents("42", "token-number"); yield reopenVarPopup(panel, { line: 20, ch: 14 }); verifyContents("42", "token-number");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-03.js @@ -6,22 +6,27 @@ /** * Tests that the inspected indentifier is highlighted. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect variable. yield openVarPopup(panel, { line: 15, ch: 12 }); ok(bubble.contentsShown(), "The variable should register as being shown."); ok(!bubble._tooltip.isEmpty(), "The variable inspection popup isn't empty.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-04.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-04.js @@ -6,22 +6,27 @@ /** * Tests that the variable inspection popup is hidden when the editor scrolls. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect variable. yield openVarPopup(panel, { line: 15, ch: 12 }); yield hideVarPopupByScrollingEditor(panel); ok(true, "The variable inspection popup was hidden."); ok(bubble._tooltip.isEmpty(), "The variable inspection popup is now empty.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-05.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-05.js @@ -7,17 +7,21 @@ * Tests opening the variable inspection popup on a variable which has a * simple object as the value. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; function verifyContents() { is(tooltip.querySelectorAll(".variables-view-container").length, 1, "There should be one variables view container added to the tooltip."); @@ -35,18 +39,19 @@ function test() { "The first property's value is correct."); is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "__proto__", "The second property's name is correct."); is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "Object", "The second property's value is correct."); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect variable. yield openVarPopup(panel, { line: 16, ch: 12 }, true); verifyContents(); yield resumeDebuggerThenCloseAndFinish(panel); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-06.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-06.js @@ -8,17 +8,21 @@ * complext object as the value. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { requestLongerTimeout(2); Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; function verifyContents() { is(tooltip.querySelectorAll(".variables-view-container").length, 1, "There should be one variables view container added to the tooltip."); @@ -61,18 +65,19 @@ function test() { "The sixth property's value is correct."); is(tooltip.querySelectorAll(".variables-view-property .name")[6].getAttribute("value"), "__proto__", "The seventh property's name is correct."); is(tooltip.querySelectorAll(".variables-view-property .value")[6].getAttribute("value"), "Object", "The seventh property's value is correct."); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect variable. yield openVarPopup(panel, { line: 17, ch: 12 }, true); verifyContents(); yield resumeDebuggerThenCloseAndFinish(panel); }); }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-07.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-07.js @@ -7,17 +7,21 @@ * Tests the variable inspection popup behaves correctly when switching * between simple and complex objects. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; function verifySimpleContents(textContent, className) { is(tooltip.querySelectorAll(".variables-view-container").length, 0, "There should be no variables view container added to the tooltip."); is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1, @@ -39,18 +43,19 @@ function test() { "There should be one scope with no header displayed."); is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, "There should be one variable with no header displayed."); ok(tooltip.querySelectorAll(".variables-view-property").length >= propertyCount, "There should be some properties displayed."); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Inspect variables. yield openVarPopup(panel, { line: 15, ch: 12 }); verifySimpleContents("1", "token-number"); yield reopenVarPopup(panel, { line: 16, ch: 12 }, true); verifyComplexContents(2);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-08.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-08.js @@ -6,17 +6,21 @@ /** * Tests opening inspecting variables works across scopes. */ const TAB_URL = EXAMPLE_URL + "doc_scope-variable.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let editor = win.DebuggerView.editor; let frames = win.DebuggerView.StackFrames; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; function verifyContents(textContent, className) { @@ -37,18 +41,20 @@ function test() { is(frames.itemCount, 2, "Should have two frames."); is(frames.selectedDepth, selectedFrame, "The correct frame is selected in the widget."); ok(isCaretPos(panel, caretLine), "Editor caret location is correct."); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 20); callInTab(tab, "test"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 20); + yield onCaretAndScopes; + checkView(0, 20); // Inspect variable in topmost frame. yield openVarPopup(panel, { line: 18, ch: 12 }); verifyContents("\"second scope\"", "token-string"); checkView(0, 20); // Hide the popup and change the frame.
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-09.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-09.js @@ -6,23 +6,28 @@ /** * Tests opening inspecting variables works across scopes. */ const TAB_URL = EXAMPLE_URL + "doc_scope-variable-3.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; + let onCaretAndScopes = waitForCaretAndScopes(panel, 15); callInTab(tab, "test"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 15); + yield onCaretAndScopes; yield openVarPopup(panel, { line: 12, ch: 10 }); ok(true, "The variable inspection popup was shown for the real variable."); once(tooltip, "popupshown").then(() => { ok(false, "The variable inspection popup shouldn't have been opened."); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js @@ -8,27 +8,32 @@ * a variable inspection popup is opened and a watch expression is * also evaluated at the same time. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let editor = win.DebuggerView.editor; let editorContainer = win.document.getElementById("editor"); let bubble = win.DebuggerView.VariableBubble; let expressions = win.DebuggerView.WatchExpressions; let tooltip = bubble._tooltip.panel; + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressions.addExpression("this"); editor.focus(); yield expressionsEvaluated; // Scroll to the top of the editor and inspect variables. let breakpointScrollPosition = editor.getScrollInfo().top;
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-11.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-11.js @@ -6,17 +6,21 @@ /** * Tests that the watch expression button is added in variable view popup. */ const TAB_URL = EXAMPLE_URL + "doc_watch-expression-button.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let watch = win.DebuggerView.WatchExpressions; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; let label = win.L10N.getStr("addWatchExpressionButton"); let className = "dbg-expression-button"; @@ -34,18 +38,19 @@ function test() { ok(!tooltip.querySelector("button"), "There should be no button available in variable view popup."); ok(watch.getItemAtIndex(0), "The expression at index 0 should be available."); is(watch.getItemAtIndex(0).attachment.initialExpression, aExpression, "The expression at index 0 is correct."); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 19); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 19); + yield onCaretAndScopes; // Inspect primitive value variable. yield openVarPopup(panel, { line: 15, ch: 12 }); let popupHiding = once(tooltip, "popuphiding"); let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); testExpressionButton(label, className, "a"); yield promise.all([popupHiding, expressionsEvaluated]); ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1).");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-12.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-12.js @@ -7,35 +7,40 @@ * Tests that the clicking "Watch" button twice, for the same expression, only adds it * once. */ const TAB_URL = EXAMPLE_URL + "doc_watch-expression-button.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let watch = win.DebuggerView.WatchExpressions; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; function verifyContent(aExpression, aItemCount) { ok(watch.getItemAtIndex(0), "The expression at index 0 should be available."); is(watch.getItemAtIndex(0).attachment.initialExpression, aExpression, "The expression at index 0 is correct."); is(watch.itemCount, aItemCount, "The expression count is correct."); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 19); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 19); + yield onCaretAndScopes; // Inspect primitive value variable. yield openVarPopup(panel, { line: 15, ch: 12 }); let popupHiding = once(tooltip, "popuphiding"); let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); tooltip.querySelector("button").click(); verifyContent("a", 1); yield promise.all([popupHiding, expressionsEvaluated]);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-13.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-13.js @@ -7,17 +7,21 @@ * Tests that the variable inspection popup has inspector links for DOMNode * properties and that the popup closes when the link is clicked */ const TAB_URL = EXAMPLE_URL + "doc_domnode-variables.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; let toolbox = gDevTools.getToolbox(panel.target); function getDomNodeInTooltip(propertyName) { let domNodeProperties = tooltip.querySelectorAll(".token-domnode"); for (let prop of domNodeProperties) { @@ -25,18 +29,19 @@ function test() { if (propName.getAttribute("value") === propertyName) { ok(true, "DOMNode " + propertyName + " was found in the tooltip"); return prop; } } ok(false, "DOMNode " + propertyName + " wasn't found in the tooltip"); } + let onCaretAndScopes = waitForCaretAndScopes(panel, 19); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 19); + yield onCaretAndScopes; // Inspect the div DOM variable. yield openVarPopup(panel, { line: 17, ch: 38 }, true); let property = getDomNodeInTooltip("firstElementChild"); // Simulate mouseover on the property value let highlighted = once(toolbox, "node-highlight"); EventUtils.sendMouseEvent({ type: "mouseover" }, property,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-14.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-14.js @@ -7,22 +7,27 @@ * Tests that the variable inspection popup is hidden when * selecting text in the editor. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; // Select some text. let cursor = win.DebuggerView.editor.getOffset({ line: 15, ch: 12 }); let [ anchor, head ] = win.DebuggerView.editor.getPosition( cursor, cursor + 3 ); win.DebuggerView.editor.setSelection(anchor, head);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-15.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-15.js @@ -6,23 +6,28 @@ /** * Tests opening the variable inspection popup directly on literals. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); callInTab(tab, "start"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + yield onCaretAndScopes; yield openVarPopup(panel, { line: 15, ch: 12 }); ok(true, "The variable inspection popup was shown for the real variable."); once(tooltip, "popupshown").then(() => { ok(false, "The variable inspection popup shouldn't have been opened."); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-16.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-16.js @@ -9,17 +9,21 @@ requestLongerTimeout(2); * Tests if opening the variables inspection popup preserves the highlighting * associated with the currently debugged line. */ const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; function test() { Task.spawn(function* () { - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let win = panel.panelWin; let events = win.EVENTS; let editor = win.DebuggerView.editor; let frames = win.DebuggerView.StackFrames; let variables = win.DebuggerView.Variables; let bubble = win.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; @@ -50,18 +54,20 @@ function test() { is(globalScope.expanded, false, "The globalScope should not be expanded yet."); let finished = waitForDebuggerEvents(panel, events.FETCHED_VARIABLES); globalScope.expand(); return finished; } + let onCaretAndScopes = waitForCaretAndScopes(panel, 26); callInTab(tab, "recurse"); - yield waitForSourceAndCaretAndScopes(panel, ".html", 26); + yield onCaretAndScopes; + yield checkView(0, 26); yield expandGlobalScope(); yield checkView(0, 26); // Inspect variable in topmost frame. yield openVarPopup(panel, { line: 26, ch: 11 }); yield checkView(0, 26);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js @@ -7,17 +7,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; let gTab, gPanel, gDebugger; let actions, gSources, gVariables; function test() { - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; actions = bindActionCreators(gPanel); gSources = gDebugger.DebuggerView.Sources; gVariables = gDebugger.DebuggerView.Variables; let bubble = gDebugger.DebuggerView.VariableBubble; let tooltip = bubble._tooltip.panel; @@ -33,17 +37,17 @@ function test() { executeSoon(() => EventUtils.synthesizeKey("VK_F11", {})); // The keypress should cause one resumed event and one paused event yield waitForThreadEvents(gPanel, "resumed"); yield waitForThreadEvents(gPanel, "paused"); // Here's the state we're actually interested in checking.. checkVariablePopupClosed(bubble); yield resumeDebuggerThenCloseAndFinish(gPanel); }); - waitForSourceShown(gPanel, ".html").then(testPopupHiding); + testPopupHiding(); }); } function addBreakpoint() { return actions.addBreakpoint({ actor: gSources.selectedValue, line: 21 }); } function pauseDebuggee() {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-reexpand-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-reexpand-01.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(4); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const gVariables = gDebugger.DebuggerView.Variables; const queries = gDebugger.require("./content/queries"); const getState = gDebugger.DebuggerController.getState; const actions = bindActionCreators(gPanel); @@ -190,17 +194,16 @@ function test() { functionScope.expand(); globalLexicalScope.expand(); globalScope.expand(); return deferred.promise; } Task.spawn(function* () { - yield waitForSourceShown(gPanel, ".html"); yield addBreakpoint(); yield ensureThreadClientState(gPanel, "resumed"); yield pauseDebuggee(); yield prepareVariablesAndProperties(); yield stepInDebuggee(); yield testVariablesExpand(); resumeDebuggerThenCloseAndFinish(gPanel); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-reexpand-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-reexpand-02.js @@ -9,17 +9,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(4); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const gVariables = gDebugger.DebuggerView.Variables; const queries = gDebugger.require("./content/queries"); const getState = gDebugger.DebuggerController.getState; const actions = bindActionCreators(gPanel); @@ -205,18 +209,16 @@ function test() { functionScope.expand(); globalLexicalScope.expand(); globalScope.expand(); return deferred.promise; } Task.spawn(function* () { - yield waitForSourceShown(gPanel, ".html"); - yield addBreakpoint(); yield ensureThreadClientState(gPanel, "resumed"); yield pauseDebuggee(); yield prepareVariablesAndProperties(); yield stepInDebuggee(); yield testVariablesExpand(); resumeDebuggerThenCloseAndFinish(gPanel); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-reexpand-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-reexpand-03.js @@ -8,17 +8,21 @@ */ const TAB_URL = EXAMPLE_URL + "doc_scope-variable-4.html"; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(4); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { const gTab = aTab; const gPanel = aPanel; const gDebugger = gPanel.panelWin; const gSources = gDebugger.DebuggerView.Sources; const gVariables = gDebugger.DebuggerView.Variables; const queries = gDebugger.require("./content/queries"); const getState = gDebugger.DebuggerController.getState; const actions = bindActionCreators(gPanel); @@ -99,17 +103,16 @@ function test() { "The localScope should not be expanded anymore."); is(functionScope.expanded, true, "The functionScope should now be expanded."); is(globalScope.expanded, false, "The globalScope should still not be expanded."); } Task.spawn(function* () { - yield waitForSourceShown(gPanel, ".html"); yield addBreakpoint(); yield ensureThreadClientState(gPanel, "resumed"); yield pauseDebuggee(); yield prepareScopes(); yield resumeDebuggee(); yield testVariablesExpand(); resumeDebuggerThenCloseAndFinish(gPanel); });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-webidl.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-webidl.js @@ -12,23 +12,27 @@ const TAB_URL = EXAMPLE_URL + "doc_frame var gTab, gPanel, gDebugger; var gVariables; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; - waitForSourceAndCaretAndScopes(gPanel, ".html", 24) + waitForCaretAndScopes(gPanel, 24) .then(expandGlobalScope) .then(performTest) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); generateMouseClickInTab(gTab, "content.document.querySelector('button')");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_watch-expressions-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_watch-expressions-01.js @@ -11,32 +11,32 @@ const TAB_URL = EXAMPLE_URL + "doc_watch function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); let gTab, gPanel, gDebugger; let gEditor, gWatch, gVariables; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gEditor = gDebugger.DebuggerView.editor; gWatch = gDebugger.DebuggerView.WatchExpressions; gVariables = gDebugger.DebuggerView.Variables; gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - waitForSourceShown(gPanel, ".html") - .then(() => performTest()) - .then(() => closeDebuggerAndFinish(gPanel)) - .then(null, aError => { - ok(false, "Got an error: " + aError.message + "\n" + aError.stack); - }); + performTest(); + closeDebuggerAndFinish(gPanel); }); function performTest() { is(gWatch.getAllStrings().length, 0, "There should initially be no watch expressions."); addAndCheckExpressions(1, 0, "a"); addAndCheckExpressions(2, 0, "b");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_watch-expressions-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_watch-expressions-02.js @@ -11,28 +11,31 @@ const TAB_URL = EXAMPLE_URL + "doc_watch function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); let gTab, gPanel, gDebugger; let gWatch, gVariables; - initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gWatch = gDebugger.DebuggerView.WatchExpressions; gVariables = gDebugger.DebuggerView.Variables; gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - waitForSourceShown(gPanel, ".html", 1) - .then(addExpressions) - .then(performTest) + addExpressions(); + performTest() .then(finishTest) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); function addExpressions() {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_worker-source-map.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_worker-source-map.js @@ -17,17 +17,21 @@ function selectWorker(aPanel, aURL) { Workers.selectedItem = item; return promise; } function test() { return Task.spawn(function* () { yield pushPrefs(["devtools.debugger.workers", true]); - let [tab,, panel] = yield initDebugger(TAB_URL); + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); let toolbox = yield selectWorker(panel, WORKER_URL); let workerPanel = toolbox.getCurrentPanel(); yield waitForSourceShown(workerPanel, ".coffee"); let panelWin = workerPanel.panelWin; let Sources = panelWin.DebuggerView.Sources; let editor = panelWin.DebuggerView.editor; let threadClient = panelWin.gThreadClient;
--- a/devtools/client/debugger/test/mochitest/head.js +++ b/devtools/client/debugger/test/mochitest/head.js @@ -97,16 +97,17 @@ this.removeTab = function removeTab(aTab let deferred = promise.defer(); let targetWindow = aWindow || window; let targetBrowser = targetWindow.gBrowser; let tabContainer = targetBrowser.tabContainer; tabContainer.addEventListener("TabClose", function onClose(aEvent) { tabContainer.removeEventListener("TabClose", onClose, false); + info("Tab removed and finished closing."); deferred.resolve(); }, false); targetBrowser.removeTab(aTab); return deferred.promise; }; @@ -507,39 +508,87 @@ function getSources(aClient) { aClient.getSources((packet) => { deferred.resolve(packet.sources); }); return deferred.promise; } -function initDebugger(aTarget, aWindow) { +/** + * Optionaly open a new tab and then open the debugger panel. + * The returned promise resolves only one the panel is fully set. + + * @param {String|xul:tab} urlOrTab + * If a string, consider it as the url of the tab to open before opening the + * debugger panel. + * Otherwise, if a <xul:tab>, do nothing, but open the debugger panel against + * the given tab. + * @param {Object} options + * Set of optional arguments: + * - {String} source + * If given, assert the default loaded source once the debugger is loaded. + * This string can be partial to only match a part of the source name. + * If null, do not expect any source and skip SOURCE_SHOWN wait. + * - {Number} line + * If given, wait for the caret to be set on a precise line + * + * @return {Promise} + * Resolves once debugger panel is fully set according to the given options. + */ +let initDebugger = Task.async(function*(urlOrTab, options) { + let { window, source, line } = options || {}; info("Initializing a debugger panel."); - return getTab(aTarget, aWindow).then(aTab => { - info("Debugee tab added successfully: " + aTarget); + let tab, url; + if (urlOrTab instanceof XULElement) { + // `urlOrTab` Is a Tab. + tab = urlOrTab; + } else { + // `urlOrTab` is an url. Open an empty tab first in order to load the page + // only once the panel is ready. That to be able to safely catch the + // SOURCE_SHOWN event. + tab = yield addTab("about:blank", window); + url = urlOrTab; + } + info("Debugee tab added successfully: " + urlOrTab); - let deferred = promise.defer(); - let debuggee = aTab.linkedBrowser.contentWindow.wrappedJSObject; - let target = TargetFactory.forTab(aTab); + let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject; + let target = TargetFactory.forTab(tab); - gDevTools.showToolbox(target, "jsdebugger").then(aToolbox => { - info("Debugger panel shown successfully."); + let toolbox = yield gDevTools.showToolbox(target, "jsdebugger"); + info("Debugger panel shown successfully."); + + let debuggerPanel = toolbox.getCurrentPanel(); + let panelWin = debuggerPanel.panelWin; - let debuggerPanel = aToolbox.getCurrentPanel(); - let panelWin = debuggerPanel.panelWin; + prepareDebugger(debuggerPanel); - prepareDebugger(debuggerPanel); - deferred.resolve([aTab, debuggee, debuggerPanel, aWindow]); - }); + if (url && url != "about:blank") { + let onCaretUpdated; + if (line) { + onCaretUpdated = waitForCaretUpdated(debuggerPanel, line); + } + if (source === null) { + // When there is no source in the document, we shouldn't wait for + // SOURCE_SHOWN event + yield reload(debuggerPanel, url); + } else { + yield navigateActiveTabTo(debuggerPanel, + url, + panelWin.EVENTS.SOURCE_SHOWN); + } + if (source) { + ensureSourceIs(debuggerPanel, source); + } + yield onCaretUpdated; + } - return deferred.promise; - }); -} + return [tab, debuggee, debuggerPanel, window]; +}); // Creates an add-on debugger for a given add-on. The returned AddonDebugger // object must be destroyed before finishing the test function initAddonDebugger(aUrl) { let addonDebugger = new AddonDebugger(); return addonDebugger.init(aUrl).then(() => addonDebugger); }