toolkit/devtools/server/tests/unit/test_longstringgrips-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(
    19       gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
    20         gThreadClient = aThreadClient;
    21         test_longstring_grip();
    22       });
    23   });
    24   do_test_pending();
    25 }
    27 function test_longstring_grip()
    28 {
    29   DebuggerServer.LONG_STRING_LENGTH = 200;
    31   gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
    32     try {
    33       let fakeLongStringGrip = {
    34         type: "longString",
    35         length: 1000000,
    36         actor: "123fakeActor123",
    37         initial: ""
    38       };
    39       let longStringClient = gThreadClient.pauseLongString(fakeLongStringGrip);
    40       longStringClient.substring(22, 28, function (aResponse) {
    41         try {
    42           do_check_true(!!aResponse.error,
    43                         "We should not get a response, but an error.");
    44         } finally {
    45           gThreadClient.resume(function() {
    46             finishClient(gClient);
    47           });
    48         }
    49       });
    50     } catch(error) {
    51       gThreadClient.resume(function() {
    52         finishClient(gClient);
    53         do_throw(error);
    54       });
    55     }
    56   });
    58   gDebuggee.eval('stopMe()');
    59 }

mercurial