toolkit/devtools/server/tests/unit/test_frameactor-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  * Verify that frame actors retrieved with the frames request
     6  * are included in the pause packet's popped-frames property.
     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_pause_frame();
    22     });
    23   });
    24   do_test_pending();
    25 }
    27 function test_frame_slice() {
    28   if (gSliceTests.length == 0) {
    29     gThreadClient.resume(function() { finishClient(gClient); });
    30     return;
    31   }
    33   let test = gSliceTests.shift();
    34   gThreadClient.getFrames(test.start, test.count, function(aResponse) {
    35     var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined);
    36     do_check_eq(testFrames.length, aResponse.frames.length);
    37     for (var i = 0; i < testFrames.length; i++) {
    38       let expected = testFrames[i];
    39       let actual = aResponse.frames[i];
    41       if (test.resetActors) {
    42         expected.actor = actual.actor;
    43       }
    45       for (var key in expected) {
    46         do_check_eq(expected[key], actual[key]);
    47       }
    48     }
    49     test_frame_slice();
    50   });
    51 }
    53 function test_pause_frame()
    54 {
    55   gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket1) {
    56     gThreadClient.getFrames(0, null, function(aFrameResponse) {
    57       do_check_eq(aFrameResponse.frames.length, 5);
    58       // Now wait for the next pause, after which the three
    59       // youngest actors should be popped..
    60       let expectPopped = [frame.actor for each (frame in aFrameResponse.frames.slice(0, 3))];
    61       expectPopped.sort()
    63       gThreadClient.addOneTimeListener("paused", function(aEvent, aPausePacket) {
    64         let popped = aPausePacket.poppedFrames.sort();
    65         do_check_eq(popped.length, 3);
    66         for (let i = 0; i < 3; i++) {
    67           do_check_eq(expectPopped[i], popped[i]);
    68         }
    70         gThreadClient.resume(function() { finishClient(gClient); });
    71       });
    72       gThreadClient.resume();
    73     });
    74   });
    76   gDebuggee.eval("(" + function() {
    77     function depth3() {
    78       debugger;
    79     }
    80     function depth2() {
    81       depth3();
    82     }
    83     function depth1() {
    84       depth2();
    85     };
    86     depth1();
    87     debugger;
    88   } + ")()");
    89 }

mercurial