browser/devtools/debugger/test/browser_dbg_pretty-print-on-paused.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2   http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Test that pretty printing when the debugger is paused does not switch away
     6  * from the selected source.
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_pretty-print-on-paused.html";
    11 let gTab, gDebuggee, gPanel, gDebugger, gThreadClient, gSources;
    13 const SECOND_SOURCE_VALUE = EXAMPLE_URL + "code_ugly-2.js";
    15 function test(){
    16   initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    17     gTab = aTab;
    18     gDebuggee = aDebuggee;
    19     gPanel = aPanel;
    20     gDebugger = gPanel.panelWin;
    21     gThreadClient = gDebugger.gThreadClient;
    22     gSources = gDebugger.DebuggerView.Sources;
    24     Task.spawn(function* () {
    25       try {
    26         yield ensureSourceIs(gPanel, "code_script-switching-02.js", true);
    28         yield doInterrupt(gPanel);
    29         yield rdpInvoke(gThreadClient, gThreadClient.setBreakpoint, {
    30           url: gSources.selectedValue,
    31           line: 6
    32         });
    33         yield doResume(gPanel);
    35         const bpHit = waitForCaretAndScopes(gPanel, 6);
    36         // Get the debuggee call off this tick so that we aren't accidentally
    37         // blocking the yielding of bpHit which causes a deadlock.
    38         executeSoon(() => gDebuggee.secondCall());
    39         yield bpHit;
    41         info("Switch to the second source.");
    42         const sourceShown = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE);
    43         gSources.selectedValue = SECOND_SOURCE_VALUE;
    44         yield sourceShown;
    46         info("Pretty print the source.");
    47         const prettyPrinted = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE);
    48         gDebugger.document.getElementById("pretty-print").click();
    49         yield prettyPrinted;
    51         yield resumeDebuggerThenCloseAndFinish(gPanel);
    52       } catch (e) {
    53         DevToolsUtils.reportException("browser_dbg_pretty-print-on-paused.js", e);
    54         ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
    55       }
    56     });
    57   });
    58 }
    60 registerCleanupFunction(function() {
    61   gTab = null;
    62   gDebuggee = null;
    63   gPanel = null;
    64   gDebugger = null;
    65   gThreadClient = null;
    66   gSources = null;
    67 });

mercurial