toolkit/devtools/server/tests/unit/test_listsources-01.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 basic getSources functionality.
     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_simple_listsources();
    31     });
    32   });
    33   do_test_pending();
    34 }
    36 function test_simple_listsources()
    37 {
    38   gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
    39     gThreadClient.getSources(function (aResponse) {
    40       do_check_true(aResponse.sources.some(function (s) {
    41         return s.url.match(/test_listsources-01.js$/);
    42       }));
    44       do_check_true(gNumTimesSourcesSent <= 1,
    45                     "Should only send one sources request at most, even though we"
    46                     + " might have had to send one to determine feature support.");
    48       gThreadClient.resume(function () {
    49         finishClient(gClient);
    50       });
    51     });
    52   });
    54   gDebuggee.eval("var line0 = Error().lineNumber;\n" +
    55        "debugger;\n" +   // line0 + 1
    56        "var a = 1;\n" +  // line0 + 2
    57        "var b = 2;\n");  // line0 + 3
    58 }

mercurial