browser/devtools/debugger/test/browser_dbg_server-conditional-bp-03.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 conditional breakpoints survive disabled breakpoints
     6  * (with server-side support)
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html";
    11 function test() {
    12   let gTab, gDebuggee, gPanel, gDebugger;
    13   let gSources, gBreakpoints, gLocation;
    15   initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    16     gTab = aTab;
    17     gDebuggee = aDebuggee;
    18     gPanel = aPanel;
    19     gDebugger = gPanel.panelWin;
    20     gSources = gDebugger.DebuggerView.Sources;
    21     gBreakpoints = gDebugger.DebuggerController.Breakpoints;
    23     gLocation = { url: gSources.selectedValue, line: 18 };
    25     waitForSourceAndCaretAndScopes(gPanel, ".html", 17)
    26       .then(addBreakpoint)
    27       .then(setConditional)
    28       .then(() => {
    29         let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_REMOVED);
    30         toggleBreakpoint();
    31         return finished;
    32       })
    33       .then(() => {
    34         let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED);
    35         toggleBreakpoint();
    36         return finished;
    37       })
    38       .then(testConditionalExpressionOnClient)
    39       .then(() => {
    40         let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING);
    41         openConditionalPopup();
    42         return finished;
    43       })
    44       .then(testConditionalExpressionInPopup)
    45       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
    46       .then(null, aError => {
    47         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    48       });
    50     gDebuggee.ermahgerd();
    51   });
    53   function addBreakpoint() {
    54     return gPanel.addBreakpoint(gLocation);
    55   }
    57   function setConditional(aClient) {
    58     return gBreakpoints.updateCondition(aClient.location, "hello");
    59   }
    61   function toggleBreakpoint() {
    62     EventUtils.sendMouseEvent({ type: "click" },
    63       gDebugger.document.querySelector(".dbg-breakpoint-checkbox"),
    64       gDebugger);
    65   }
    67   function openConditionalPopup() {
    68     EventUtils.sendMouseEvent({ type: "click" },
    69       gDebugger.document.querySelector(".dbg-breakpoint"),
    70       gDebugger);
    71   }
    73   function testConditionalExpressionOnClient() {
    74     return gBreakpoints._getAdded(gLocation).then(aClient => {
    75       is(aClient.condition, "hello", "The expression is correct (1).");
    76     });
    77   }
    79   function testConditionalExpressionInPopup() {
    80     let textbox = gDebugger.document.getElementById("conditional-breakpoint-panel-textbox");
    81     is(textbox.value, "hello", "The expression is correct (2).")
    82   }
    83 }

mercurial