toolkit/components/osfile/tests/xpcshell/test_queue.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 "use strict";
     3 Components.utils.import("resource://gre/modules/osfile.jsm");
     5 function run_test() {
     6   run_next_test();
     7 }
     9 // Check if Scheduler.queue returned by OS.File.queue is resolved initially.
    10 add_task(function* check_init() {
    11   yield OS.File.queue;
    12   do_print("Function resolved");
    13 });
    15 // Check if Scheduler.queue returned by OS.File.queue is resolved
    16 // after an operation is successful.
    17 add_task(function* check_success() {
    18   do_print("Attempting to open a file correctly");
    19   let openedFile = yield OS.File.open(OS.Path.join(do_get_cwd().path, "test_queue.js"));
    20   do_print("File opened correctly");
    21   yield OS.File.queue;
    22   do_print("Function resolved");
    23 });
    25 // Check if Scheduler.queue returned by OS.File.queue is resolved
    26 // after an operation fails.
    27 add_task(function* check_failure() {
    28   let exception;
    29   try {
    30     do_print("Attempting to open a non existing file");
    31     yield OS.File.open(OS.Path.join(".", "Bigfoot"));
    32   } catch (err) {
    33     exception = err;
    34     yield OS.File.queue;
    35   }  
    36   do_check_true(exception!=null);
    37   do_print("Function resolved");
    38 });

mercurial