2014-02-27 08:39:56 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
2014-04-24 10:09:00 -07:00
|
|
|
* Test that pretty printing when the debugger is paused does not switch away
|
|
|
|
* from the selected source.
|
2014-02-27 08:39:56 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-on-paused.html";
|
|
|
|
|
2014-11-06 01:27:45 -08:00
|
|
|
let gTab, gPanel, gDebugger, gThreadClient, gSources;
|
2014-02-27 08:39:56 -08:00
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
const SECOND_SOURCE_VALUE = EXAMPLE_URL + "code_ugly-2.js";
|
2014-02-27 08:39:56 -08:00
|
|
|
|
|
|
|
function test(){
|
2014-11-06 01:27:45 -08:00
|
|
|
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
|
2014-02-27 08:39:56 -08:00
|
|
|
gTab = aTab;
|
|
|
|
gPanel = aPanel;
|
|
|
|
gDebugger = gPanel.panelWin;
|
2014-04-24 10:09:00 -07:00
|
|
|
gThreadClient = gDebugger.gThreadClient;
|
2014-02-27 08:39:56 -08:00
|
|
|
gSources = gDebugger.DebuggerView.Sources;
|
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
Task.spawn(function* () {
|
|
|
|
try {
|
|
|
|
yield ensureSourceIs(gPanel, "code_script-switching-02.js", true);
|
2014-02-27 08:39:56 -08:00
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
yield doInterrupt(gPanel);
|
|
|
|
yield rdpInvoke(gThreadClient, gThreadClient.setBreakpoint, {
|
|
|
|
url: gSources.selectedValue,
|
|
|
|
line: 6
|
|
|
|
});
|
|
|
|
yield doResume(gPanel);
|
2014-02-27 08:39:56 -08:00
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
const bpHit = waitForCaretAndScopes(gPanel, 6);
|
2014-11-06 01:27:45 -08:00
|
|
|
callInTab(gTab, "secondCall");
|
2014-04-24 10:09:00 -07:00
|
|
|
yield bpHit;
|
2014-02-27 08:39:56 -08:00
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
info("Switch to the second source.");
|
|
|
|
const sourceShown = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE);
|
|
|
|
gSources.selectedValue = SECOND_SOURCE_VALUE;
|
|
|
|
yield sourceShown;
|
2014-02-27 08:39:56 -08:00
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
info("Pretty print the source.");
|
|
|
|
const prettyPrinted = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE);
|
|
|
|
gDebugger.document.getElementById("pretty-print").click();
|
|
|
|
yield prettyPrinted;
|
2014-02-27 08:39:56 -08:00
|
|
|
|
2014-04-24 10:09:00 -07:00
|
|
|
yield resumeDebuggerThenCloseAndFinish(gPanel);
|
|
|
|
} catch (e) {
|
|
|
|
DevToolsUtils.reportException("browser_dbg_pretty-print-on-paused.js", e);
|
|
|
|
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2014-02-27 08:39:56 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(function() {
|
|
|
|
gTab = null;
|
|
|
|
gPanel = null;
|
|
|
|
gDebugger = null;
|
2014-04-24 10:09:00 -07:00
|
|
|
gThreadClient = null;
|
2014-02-27 08:39:56 -08:00
|
|
|
gSources = null;
|
|
|
|
});
|