Files
roytam1 24dc63cddd import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1205941 - Make TimerFirings logging output post-processible with fix_linux_stack.py. r=glandium. (042e3968a2)
- Bug 1203427 (part 6) - Add link to MDN docs about TimerFirings logging. r=me. (19967a22e7)
- missing bit of Bug 1178890 (b421ab56a1)
- Bug 1207497 - Part 1: Remove use of expression closure from toolkit/, exept tests. r=Gijs (4cf4abbf3d)
- Bug 1207497 - Part 2: Remove use of expression closure from tests in toolkit/. r=Gijs (6c4517c20e)
- Bug 1207497 - Part 3: Fix wrong replacement in debug print in toolkit/mozapps/downloads/tests/unit/test_lowMinutes.js. r=me DONTBUILD (5311950d45)
- bug 1171649 - Implement arm/iOS support in JS JITs. r=jandem (0eb06f1d3d)
- Bug 1205708: Check if validation failed before reporting helper thread failure in Odin; r=luke (0bd8b70919)
- missing bit of Bug 1112627: Remove redundant inline specifier in SIMD (76cea80b8c)
- Bug 1189059: Replace setObjectMetadataCallback with enableObjectMetadataCallback, fix callers. r=fitzgen (053ae86af2)
- Bug 1125412 - Draw a graph of memory usage, r=terrence (4ac21380a4)
- Bug 1147985 - Avoid blank space when heap size graph is unavailable, r=terrence (9b48d4d435)
- Bug 1170372 - Skip js1_5/Regress/regress-312588.js on SM(cgc) builds due to timeouts. (5298485837)
- Bug 1160149 - Skip basic/testManyVars.js on SM(cgc) builds for frequent timeouts. (562cfc2713)
- Bug 1198549 - Switch from | to $ as the preferred separator token (due to operator|), r=me\ (cc6fdb0697)
- Bug 963738 - Handle Arrays in the analysis, r=terrence (589b285306)
- Bug 1209696 - Check the return value of fopen, r=terrence (8c2378f3f9)
- Bug 1197941 - Allow getline() to malloc its own buffer to avoid intermittent crashes, r=shu (e37b934fcc)
- Bug 1180985 - Implement a JS GDB pretty-printer for JS::GCCellPtr. r=sfink (8848723b3a)
- Bug 1180984 - JS GDB pretty-printers: Support Python 3. r=sfink (ae4c76014d)
- Bug 1198628 - IonMonkey: ARM: Redefine FloatRegisters::Code and use it in the right way. r=nbp (d0d608b1cc)
- Bug 1198145 - guard calls to getInst(). r=me (bb8c4e2e4b)
2022-09-19 14:02:02 +08:00

58 lines
1.9 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests exports from Timer.jsm
let imported = {};
Components.utils.import("resource://gre/modules/Timer.jsm", imported);
function run_test() {
run_next_test();
}
add_task(function* test_setTimeout() {
let timeout1 = imported.setTimeout(() => do_throw("Should not be called"), 100);
do_check_eq(typeof timeout1, "number", "setTimeout returns a number");
do_check_true(timeout1 > 0, "setTimeout returns a positive number");
imported.clearTimeout(timeout1);
yield new Promise((resolve) => {
let timeout2 = imported.setTimeout((param1, param2) => {
do_check_true(true, "Should be called");
do_check_eq(param1, 5, "first parameter is correct");
do_check_eq(param2, "test", "second parameter is correct");
resolve();
}, 100, 5, "test");
do_check_eq(typeof timeout2, "number", "setTimeout returns a number");
do_check_true(timeout2 > 0, "setTimeout returns a positive number");
do_check_neq(timeout1, timeout2, "Calling setTimeout again returns a different value");
});
});
add_task(function* test_setInterval() {
let interval1 = imported.setInterval(() => do_throw("Should not be called!"), 100);
do_check_eq(typeof interval1, "number", "setInterval returns a number");
do_check_true(interval1 > 0, "setTimeout returns a positive number");
imported.clearInterval(interval1);
const EXPECTED_CALLS = 5;
let calls = 0;
yield new Promise((resolve) => {
let interval2 = imported.setInterval((param1, param2) => {
do_check_true(true, "Should be called");
do_check_eq(param1, 15, "first parameter is correct");
do_check_eq(param2, "hola", "second parameter is correct");
if (calls >= EXPECTED_CALLS) {
resolve();
}
calls++;
}, 100, 15, "hola");
});
});