From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../browser_dbg_pretty-print-on-paused.js | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-on-paused.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-on-paused.js') diff --git 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 new file mode 100644 index 000000000..12e3a20fc --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-on-paused.js @@ -0,0 +1,69 @@ +/* -*- 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/ */ + +/** + * Test that pretty printing when the debugger is paused does not switch away + * from the selected source. + */ + +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() { + // Wait for debugger panel to be fully set and break on debugger statement + let options = { + source: EXAMPLE_URL + "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 doInterrupt(gPanel); + + let source = gThreadClient.source(getSourceForm(gSources, SECOND_SOURCE_VALUE)); + yield source.setBreakpoint({ + line: 6 + }); + yield doResume(gPanel); + + const bpHit = waitForCaretAndScopes(gPanel, 6); + callInTab(gTab, "secondCall"); + yield bpHit; + + info("Switch to the second source."); + const sourceShown = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE); + gSources.selectedValue = getSourceActor(gSources, SECOND_SOURCE_VALUE); + yield sourceShown; + + info("Pretty print the source."); + const prettyPrinted = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE); + gDebugger.document.getElementById("pretty-print").click(); + yield prettyPrinted; + + yield resumeDebuggerThenCloseAndFinish(gPanel); + } catch (e) { + DevToolsUtils.reportException("browser_dbg_pretty-print-on-paused.js", e); + ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e)); + } + }); + }); +} + +registerCleanupFunction(function () { + gTab = null; + gPanel = null; + gDebugger = null; + gThreadClient = null; + gSources = null; +}); -- cgit v1.2.3