toolkit/devtools/server/tests/unit/test_breakpoint-05.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 setting a breakpoint in a line without code in a child script
     6  * will skip forward.
     7  */
     9 var gDebuggee;
    10 var gClient;
    11 var gThreadClient;
    13 function run_test()
    14 {
    15   initTestDebuggerServer();
    16   gDebuggee = addTestGlobal("test-stack");
    17   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    18   gClient.connect(function () {
    19     attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
    20       gThreadClient = aThreadClient;
    21       test_child_skip_breakpoint();
    22     });
    23   });
    24   do_test_pending();
    25 }
    27 function test_child_skip_breakpoint()
    28 {
    29   gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    30     let path = getFilePath('test_breakpoint-05.js');
    31     let location = { url: path, line: gDebuggee.line0 + 3};
    32     gThreadClient.setBreakpoint(location, function (aResponse, bpClient) {
    33       // Check that the breakpoint has properly skipped forward one line.
    34       do_check_eq(aResponse.actualLocation.url, location.url);
    35       do_check_eq(aResponse.actualLocation.line, location.line + 1);
    36       gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    37         // Check the return value.
    38         do_check_eq(aPacket.type, "paused");
    39         do_check_eq(aPacket.frame.where.url, path);
    40         do_check_eq(aPacket.frame.where.line, location.line + 1);
    41         do_check_eq(aPacket.why.type, "breakpoint");
    42         do_check_eq(aPacket.why.actors[0], bpClient.actor);
    43         // Check that the breakpoint worked.
    44         do_check_eq(gDebuggee.a, 1);
    45         do_check_eq(gDebuggee.b, undefined);
    47         // Remove the breakpoint.
    48         bpClient.remove(function (aResponse) {
    49           gThreadClient.resume(function () {
    50             finishClient(gClient);
    51           });
    52         });
    54       });
    55       // Continue until the breakpoint is hit.
    56       gThreadClient.resume();
    58     });
    60   });
    62   gDebuggee.eval("var line0 = Error().lineNumber;\n" +
    63                  "function foo() {\n" + // line0 + 1
    64                  "  this.a = 1;\n" +    // line0 + 2
    65                  "  // A comment.\n" +  // line0 + 3
    66                  "  this.b = 2;\n" +    // line0 + 4
    67                  "}\n" +                // line0 + 5
    68                  "debugger;\n" +        // line0 + 6
    69                  "foo();\n");           // line0 + 7
    70 }

mercurial