toolkit/devtools/server/tests/unit/test_breakpoint-16.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Check that we can set breakpoints in columns, not just lines.
     6  */
     8 var gDebuggee;
     9 var gClient;
    10 var gThreadClient;
    12 function run_test()
    13 {
    14   initTestDebuggerServer();
    15   gDebuggee = addTestGlobal("test-breakpoints");
    16   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    17   gClient.connect(function () {
    18     attachTestTabAndResume(gClient,
    19                            "test-breakpoints",
    20                            function (aResponse, aTabClient, aThreadClient) {
    21       gThreadClient = aThreadClient;
    22       test_column_breakpoint();
    23     });
    24   });
    25   do_test_pending();
    26 }
    28 function test_column_breakpoint()
    29 {
    30   const location = {
    31     url: "https://example.com/foo.js",
    32     line: 1,
    33     column: 55
    34   };
    36   // Debugger statement
    37   gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    38     let timesBreakpointHit = 0;
    40     gThreadClient.setBreakpoint(location, function (aResponse, bpClient) {
    41       gThreadClient.addListener("paused", function _onPaused(aEvent, aPacket) {
    42         do_check_eq(aPacket.type, "paused");
    43         do_check_eq(aPacket.why.type, "breakpoint");
    44         do_check_eq(aPacket.why.actors[0], bpClient.actor);
    45         do_check_eq(aPacket.frame.where.url, location.url);
    46         do_check_eq(aPacket.frame.where.line, location.line);
    47         do_check_eq(aPacket.frame.where.column, location.column);
    49         do_check_eq(gDebuggee.acc, timesBreakpointHit);
    50         do_check_eq(aPacket.frame.environment.bindings.variables.i.value,
    51                     timesBreakpointHit);
    53         if (++timesBreakpointHit === 3) {
    54           gThreadClient.removeListener("paused", _onPaused);
    55           bpClient.remove(function (aResponse) {
    56             gThreadClient.resume(() => finishClient(gClient));
    57           });
    58         } else {
    59           gThreadClient.resume();
    60         }
    61       });
    63       // Continue until the breakpoint is hit.
    64       gThreadClient.resume();
    65     });
    67   });
    69   let code =
    70 "(function () { debugger; this.acc = 0; for (let i = 0; i < 3; i++) this.acc++; }());";
    72   Components.utils.evalInSandbox(code, gDebuggee, "1.8",
    73                                  location.url, 1);
    74 }

mercurial