toolkit/devtools/server/tests/unit/test_threadlifetime-04.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 requesting a thread-lifetime actor twice for the same
     6  * value returns the same actor.
     7  */
     9 var gDebuggee;
    10 var gClient;
    11 var gThreadClient;
    13 function run_test()
    14 {
    15   initTestDebuggerServer();
    16   gDebuggee = addTestGlobal("test-grips");
    17   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    18   gClient.connect(function() {
    19     attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) {
    20       gThreadClient = aThreadClient;
    21       test_thread_lifetime();
    22     });
    23   });
    24   do_test_pending();
    25 }
    27 function test_thread_lifetime()
    28 {
    29   gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    30     let pauseGrip = aPacket.frame.arguments[0];
    32     gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function (aResponse) {
    33       // Successful promotion won't return an error.
    34       do_check_eq(aResponse.error, undefined);
    36       let threadGrip1 = aResponse.from;
    38       gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function (aResponse) {
    39         do_check_eq(threadGrip1, aResponse.from);
    40         gThreadClient.resume(function() {
    41           finishClient(gClient);
    42         });
    43       });
    44     });
    45   });
    47   gDebuggee.eval("(" + function() {
    48     function stopMe(arg1) {
    49       debugger;
    50     };
    51     stopMe({obj: true});
    52   } + ")()");
    53 }

mercurial