modules/libjar/zipwriter/test/unit/test_bug425768.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 DIRNAME = "test/";
     7 const time = Date.now();
     9 function run_test()
    10 {
    11   // Copy in the test file.
    12   var source = do_get_file("data/test.zip");
    13   source.copyTo(tmpFile.parent, tmpFile.leafName);
    15   // Open it and add something so the CDS is rewritten.
    16   zipW.open(tmpFile, PR_RDWR | PR_APPEND);
    17   zipW.addEntryDirectory(DIRNAME, time * PR_USEC_PER_MSEC, false);
    18   do_check_true(zipW.hasEntry(DIRNAME));
    19   zipW.close();
    21   var zipR = new ZipReader(tmpFile);
    22   do_check_true(zipR.hasEntry(DIRNAME));
    23   zipR.close();
    25   // Adding the directory would have added a fixed amount to the file size.
    26   // Any difference suggests the CDS was written out incorrectly.
    27   var extra = ZIP_FILE_HEADER_SIZE + ZIP_CDS_HEADER_SIZE +
    28               (DIRNAME.length * 2) + (ZIP_EXTENDED_TIMESTAMP_SIZE * 2);
    30   do_check_eq(source.fileSize + extra, tmpFile.fileSize);
    31 }

mercurial