toolkit/devtools/server/tests/unit/test_threadlifetime-06.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 promoting multiple pause-lifetime actors to thread-lifetime actors
     6  * works as expected.
     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 actors = [];
    31     let last;
    32     for (let aGrip of aPacket.frame.arguments) {
    33       actors.push(aGrip.actor);
    34       last = aGrip.actor;
    35     }
    37     // Create thread-lifetime actors for these objects.
    38     gThreadClient.threadGrips(actors, function(aResponse) {
    39       // Successful promotion won't return an error.
    40       do_check_eq(aResponse.error, undefined);
    42       gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
    43         // Verify that the promoted actors are returned again.
    44         actors.forEach(function(actor, i) {
    45           do_check_eq(actor, aPacket.frame.arguments[i].actor);
    46         });
    47         // Now that we've resumed, release the thread-lifetime grips.
    48         gThreadClient.releaseMany(actors, function(aResponse) {
    49           // Successful release won't return an error.
    50           do_check_eq(aResponse.error, undefined);
    52           gClient.request({ to: last, type: "bogusRequest" }, function(aResponse) {
    53             do_check_eq(aResponse.error, "noSuchActor");
    54             gThreadClient.resume(function(aResponse) {
    55               finishClient(gClient);
    56             });
    57           });
    58         });
    59       });
    60       gThreadClient.resume();
    61     });
    62   });
    64   gDebuggee.eval("(" + function() {
    65     function stopMe(arg1, arg2, arg3) {
    66       debugger;
    67       debugger;
    68     };
    69     stopMe({obj: 1}, {obj: 2}, {obj: 3});
    70   } + ")()");
    71 }

mercurial