commit fdba372a64aa0a01f380b3900b520f8a341e4ebb
parent 67b246b15740768e6cd6aed8f4178cde4f151de9
Author: Jens Stutte <jstutte@mozilla.com>
Date: Tue, 6 Jan 2026 09:15:11 +0000
Bug 1865088 - Always use Math.ceil in FirstStartup to calculate the elapsed time in ms. r=Gijs
test_firstStartup.js -> test_timeout sets the timeout to 0 for faster testing. Its seems like the linux runners are fast enough that the elapsed time rounds to 0ms,
causing the test to fail intermittently. This seems to have been fostered also by the changes in bug 1997846, as Normandy.init() now immediately returns a promise.
Using Math.ceil should fix this (the timestamp is a fraction of milliseconds).
There might be a question if the test should raise that timeout to at least 1ms, but given the test wants to make us surely time out, 0 seems appropriate to avoid a successful initialization to be faster (the spinEventLoopUntil will always fail with a 0 timeout).
Differential Revision: https://phabricator.services.mozilla.com/D277636
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toolkit/modules/FirstStartup.sys.mjs b/toolkit/modules/FirstStartup.sys.mjs
@@ -123,7 +123,7 @@ export var FirstStartup = {
this.elapsed = 0;
Services.tm.spinEventLoopUntil("FirstStartup.sys.mjs:init", () => {
- this.elapsed = Math.round(ChromeUtils.now() - startingTime);
+ this.elapsed = Math.ceil(ChromeUtils.now() - startingTime);
if (this.elapsed >= timeout) {
this._state = this.TIMED_OUT;
return true;