modules/libjar/zipwriter/test/unit/head_zipwriter.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 const Ci = Components.interfaces;
     7 const Cc = Components.classes;
     8 const NS_ERROR_IN_PROGRESS = 2152398863;
    10 const PR_RDONLY      = 0x01
    11 const PR_WRONLY      = 0x02
    12 const PR_RDWR        = 0x04
    13 const PR_CREATE_FILE = 0x08
    14 const PR_APPEND      = 0x10
    15 const PR_TRUNCATE    = 0x20
    16 const PR_SYNC        = 0x40
    17 const PR_EXCL        = 0x80
    19 const ZIP_EOCDR_HEADER_SIZE = 22;
    20 const ZIP_FILE_HEADER_SIZE = 30;
    21 const ZIP_CDS_HEADER_SIZE = 46;
    22 const ZIP_METHOD_STORE = 0
    23 const ZIP_METHOD_DEFLATE = 8
    24 const ZIP_EXTENDED_TIMESTAMP_SIZE = 9;
    26 const PR_USEC_PER_MSEC = 1000;
    27 const PR_USEC_PER_SEC  = 1000000;
    28 const PR_MSEC_PER_SEC  = 1000;
    30 const DATA_DIR = "data/";
    32 var ioSvc = Cc["@mozilla.org/network/io-service;1"]
    33              .getService(Ci.nsIIOService);
    35 var ZipWriter = Components.Constructor("@mozilla.org/zipwriter;1",
    36                                        "nsIZipWriter");
    37 var ZipReader = Components.Constructor("@mozilla.org/libjar/zip-reader;1",
    38                                        "nsIZipReader", "open");
    40 var tmpDir = do_get_profile();
    41 var tmpFile = tmpDir.clone();
    42 tmpFile.append("zipwriter-test.zip");
    43 if (tmpFile.exists())
    44   tmpFile.remove(true);
    46 var zipW = new ZipWriter();

mercurial