toolkit/devtools/server/tests/unit/test_stepping-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  * Make sure that stepping in the last statement of the last frame doesn't
     6  * cause an unexpected pause, when another JS frame is pushed on the stack
     7  * (bug 785689).
     8  */
    10 var gDebuggee;
    11 var gClient;
    12 var gThreadClient;
    14 function run_test()
    15 {
    16   initTestDebuggerServer();
    17   gDebuggee = addTestGlobal("test-stack");
    18   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    19   gClient.connect(function () {
    20     attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
    21       gThreadClient = aThreadClient;
    22       test_stepping_last();
    23     });
    24   });
    25   do_test_pending();
    26 }
    28 function test_stepping_last()
    29 {
    30   gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    31     gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    32       // Check the return value.
    33       do_check_eq(aPacket.type, "paused");
    34       do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 2);
    35       do_check_eq(aPacket.why.type, "resumeLimit");
    36       // Check that stepping worked.
    37       do_check_eq(gDebuggee.a, undefined);
    38       do_check_eq(gDebuggee.b, undefined);
    40       gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    41         // Check the return value.
    42         do_check_eq(aPacket.type, "paused");
    43         do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
    44         do_check_eq(aPacket.why.type, "resumeLimit");
    45         // Check that stepping worked.
    46         do_check_eq(gDebuggee.a, 1);
    47         do_check_eq(gDebuggee.b, undefined);
    49         gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    50           // Check the return value.
    51           do_check_eq(aPacket.type, "paused");
    52           // When leaving a stack frame the line number doesn't change.
    53           do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
    54           do_check_eq(aPacket.why.type, "resumeLimit");
    55           // Check that stepping worked.
    56           do_check_eq(gDebuggee.a, 1);
    57           do_check_eq(gDebuggee.b, 2);
    59           gThreadClient.stepIn(function () {
    60             test_next_pause();
    61           });
    62         });
    63         gThreadClient.stepIn();
    64       });
    65       gThreadClient.stepIn();
    67     });
    68     gThreadClient.stepIn();
    70   });
    72   gDebuggee.eval("var line0 = Error().lineNumber;\n" +
    73                  "debugger;\n" +   // line0 + 1
    74                  "var a = 1;\n" +  // line0 + 2
    75                  "var b = 2;\n");  // line0 + 3
    76 }
    78 function test_next_pause()
    79 {
    80   gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    81     // Check the return value.
    82     do_check_eq(aPacket.type, "paused");
    83     // Before fixing bug 785689, the type was resumeLimit.
    84     do_check_eq(aPacket.why.type, "debuggerStatement");
    86     gThreadClient.resume(function () {
    87       finishClient(gClient);
    88     });
    89   });
    91   gDebuggee.eval("debugger;");
    92 }

mercurial