toolkit/devtools/server/tests/unit/test_objectgrips-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 var gDebuggee;
     5 var gClient;
     6 var gThreadClient;
     8 function run_test()
     9 {
    10   initTestDebuggerServer();
    11   gDebuggee = addTestGlobal("test-grips");
    12   gDebuggee.eval(function stopMe(arg1) {
    13     debugger;
    14   }.toString());
    16   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    17   gClient.connect(function() {
    18     attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
    19       gThreadClient = aThreadClient;
    20       test_object_grip();
    21     });
    22   });
    23   do_test_pending();
    24 }
    26 function test_object_grip()
    27 {
    28   gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
    29     let args = aPacket.frame.arguments;
    31     do_check_eq(args[0].class, "Object");
    33     let objClient = gThreadClient.pauseGrip(args[0]);
    34     objClient.getPrototype(function(aResponse) {
    35       do_check_true(aResponse.prototype != undefined);
    37       let protoClient = gThreadClient.pauseGrip(aResponse.prototype);
    38       protoClient.getOwnPropertyNames(function(aResponse) {
    39         do_check_eq(aResponse.ownPropertyNames.length, 2);
    40         do_check_eq(aResponse.ownPropertyNames[0], "b");
    41         do_check_eq(aResponse.ownPropertyNames[1], "c");
    43         gThreadClient.resume(function() {
    44           finishClient(gClient);
    45         });
    46       });
    47     });
    49   });
    51   gDebuggee.eval(function Constr() {
    52     this.a = 1;
    53   }.toString());
    54   gDebuggee.eval("Constr.prototype = { b: true, c: 'foo' }; var o = new Constr(); stopMe(o)");
    55 }

mercurial