toolkit/devtools/server/tests/unit/test_listsources-02.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 getting sources before there are any.
     6  */
     8 var gDebuggee;
     9 var gClient;
    10 var gThreadClient;
    12 var gNumTimesSourcesSent = 0;
    14 function run_test()
    15 {
    16   initTestDebuggerServer();
    17   gDebuggee = addTestGlobal("test-stack");
    18   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    19   gClient.request = (function (request) {
    20     return function (aRequest, aOnResponse) {
    21       if (aRequest.type === "sources") {
    22         ++gNumTimesSourcesSent;
    23       }
    24       return request.call(this, aRequest, aOnResponse);
    25     };
    26   }(gClient.request));
    27   gClient.connect(function () {
    28     attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
    29       gThreadClient = aThreadClient;
    30       test_listing_zero_sources();
    31     });
    32   });
    33   do_test_pending();
    34 }
    36 function test_listing_zero_sources()
    37 {
    38   gThreadClient.getSources(function (aPacket) {
    39     do_check_true(!aPacket.error);
    40     do_check_true(!!aPacket.sources);
    41     do_check_eq(aPacket.sources.length, 0);
    43     do_check_true(gNumTimesSourcesSent <= 1,
    44                   "Should only send one sources request at most, even though we"
    45                   + " might have had to send one to determine feature support.");
    47     finishClient(gClient);
    48   });
    49 }

mercurial