toolkit/devtools/server/tests/unit/test_framebindings-07.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 var gDebuggee;
     5 var gClient;
     6 var gThreadClient;
     8 // Test that the EnvironmentClient's getBindings() method works as expected.
     9 function run_test()
    10 {
    11   initTestDebuggerServer();
    12   gDebuggee = addTestGlobal("test-bindings");
    14   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    15   gClient.connect(function() {
    16     attachTestTabAndResume(gClient, "test-bindings", function(aResponse, aTabClient, aThreadClient) {
    17       gThreadClient = aThreadClient;
    18       test_banana_environment();
    19     });
    20   });
    21   do_test_pending();
    22 }
    24 function test_banana_environment()
    25 {
    27   gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
    28     let environment = aPacket.frame.environment;
    29     do_check_eq(environment.type, "function");
    31     let parent = environment.parent;
    32     do_check_eq(parent.type, "block");
    34     let grandpa = parent.parent;
    35     do_check_eq(grandpa.type, "function");
    37     let envClient = gThreadClient.environment(environment);
    38     envClient.getBindings(aResponse => {
    39       do_check_eq(aResponse.bindings.arguments[0].z.value, "z");
    41       let parentClient = gThreadClient.environment(parent);
    42       parentClient.getBindings(aResponse => {
    43         do_check_eq(aResponse.bindings.variables.banana3.value.class, "Function");
    45         let grandpaClient = gThreadClient.environment(grandpa);
    46         grandpaClient.getBindings(aResponse => {
    47           do_check_eq(aResponse.bindings.arguments[0].y.value, "y");
    48           gThreadClient.resume(() => finishClient(gClient));
    49         });
    50       });
    51     });
    52   });
    54   gDebuggee.eval("\
    55         function banana(x) {                                            \n\
    56           return function banana2(y) {                                  \n\
    57             return function banana3(z) {                                \n\
    58               debugger;                                                 \n\
    59             };                                                          \n\
    60           };                                                            \n\
    61         }                                                               \n\
    62         banana('x')('y')('z');                                          \n\
    63         ");
    64 }

mercurial