toolkit/modules/tests/xpcshell/test_timer.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 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 "use strict";
michael@0 5
michael@0 6 // Tests exports from Timer.jsm
michael@0 7
michael@0 8 let imported = {};
michael@0 9 Components.utils.import("resource://gre/modules/Timer.jsm", imported);
michael@0 10
michael@0 11 function run_test(browser, tab, document) {
michael@0 12 do_test_pending();
michael@0 13
michael@0 14 let timeout1 = imported.setTimeout(function() do_throw("Should not be called"), 100);
michael@0 15 do_check_eq(typeof timeout1, "number", "setTimeout returns a number");
michael@0 16 do_check_true(timeout1 > 0, "setTimeout returns a positive number");
michael@0 17
michael@0 18 let timeout2 = imported.setTimeout(function(param1, param2) {
michael@0 19 do_check_true(true, "Should be called");
michael@0 20 do_check_eq(param1, 5, "first parameter is correct");
michael@0 21 do_check_eq(param2, "test", "second parameter is correct");
michael@0 22 do_test_finished();
michael@0 23 }, 100, 5, "test");
michael@0 24
michael@0 25 do_check_eq(typeof timeout2, "number", "setTimeout returns a number");
michael@0 26 do_check_true(timeout2 > 0, "setTimeout returns a positive number");
michael@0 27 do_check_neq(timeout1, timeout2, "Calling setTimeout again returns a different value");
michael@0 28
michael@0 29 imported.clearTimeout(timeout1);
michael@0 30 }

mercurial