toolkit/components/osfile/tests/xpcshell/test_available_free_space.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/. */
     5 "use strict";
     7 Components.utils.import("resource://gre/modules/osfile.jsm");
     8 Components.utils.import("resource://gre/modules/Services.jsm");
    10 do_register_cleanup(function() {
    11   Services.prefs.setBoolPref("toolkit.osfile.log", false);
    12 });
    14 function run_test() {
    15   Services.prefs.setBoolPref("toolkit.osfile.log", true);
    17   run_next_test();
    18 }
    20 /**
    21  * Test OS.File.getAvailableFreeSpace
    22  */
    23 add_task(function() {
    24   // Set up profile. We will use profile path to query for available free
    25   // space.
    26   do_get_profile();
    28   let dir = OS.Constants.Path.profileDir;
    30   // Sanity checking for the test
    31   do_check_true((yield OS.File.exists(dir)));
    33   // Query for available bytes for user
    34   let availableBytes = yield OS.File.getAvailableFreeSpace(dir);
    36   do_check_true(!!availableBytes);
    37   do_check_true(availableBytes > 0);
    38 });

mercurial