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.

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

mercurial