modules/libjar/zipwriter/test/unit/test_bug433248.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     4  */
     6 function run_test()
     7 {
     8   var test;
     9   // zipW is an uninitialised zipwriter at this point.
    10   try {
    11     test = zipW.file;
    12     do_throw("Should have thrown uninitialized error.");
    13   }
    14   catch (e) {
    15     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    16   }
    18   try {
    19     test = zipW.comment;
    20     do_throw("Should have thrown uninitialized error.");
    21   }
    22   catch (e) {
    23     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    24   }
    26   try {
    27     zipW.comment = "test";
    28     do_throw("Should have thrown uninitialized error.");
    29   }
    30   catch (e) {
    31     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    32   }
    34   try {
    35     zipW.addEntryDirectory("test", 0, false);
    36     do_throw("Should have thrown uninitialized error.");
    37   }
    38   catch (e) {
    39     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    40   }
    42   try {
    43     zipW.addEntryFile("test", Ci.nsIZipWriter.COMPRESSION_DEFAULT, tmpDir, false);
    44     do_throw("Should have thrown uninitialized error.");
    45   }
    46   catch (e) {
    47     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    48   }
    50   try {
    51     zipW.removeEntry("test", false);
    52     do_throw("Should have thrown uninitialized error.");
    53   }
    54   catch (e) {
    55     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    56   }
    58   try {
    59     zipW.processQueue(null, null);
    60     do_throw("Should have thrown uninitialized error.");
    61   }
    62   catch (e) {
    63     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    64   }
    66   try {
    67     zipW.close();
    68     do_throw("Should have thrown uninitialized error.");
    69   }
    70   catch (e) {
    71     do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED);
    72   }
    73 }

mercurial