Bug 1442940 Turn off jitter for dom/base/test/test_timeout_clamp.html which is (likely) causing intermittents r=baku
authorTom Ritter <tom@mozilla.com>
Tue, 06 Mar 2018 11:10:10 -0600
changeset 462041 635d311ec745da07a7e893787fb29ab2aa13dcfe
parent 462040 e6069d8a3dafd6bbb06b321562adcd5aa55f9c4e
child 462042 a628b2125a1b860c6d8124387040ec9589c219ab
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1442940
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1442940 Turn off jitter for dom/base/test/test_timeout_clamp.html which is (likely) causing intermittents r=baku MozReview-Commit-ID: 9nfiBbqsATT
dom/base/test/test_timeout_clamp.html
--- a/dom/base/test/test_timeout_clamp.html
+++ b/dom/base/test/test_timeout_clamp.html
@@ -69,54 +69,64 @@ async function runTests() {
   // Things like pushPrefEnv() can use setTimeout() internally which may give
   // us a nesting level.  Clear the nesting level to start so this doesn't
   // confuse the test.
   await clearNestingLevel();
 
   // Verify a setTimeout() chain clamps correctly
   let start = performance.now();
   await delayByTimeoutChain(expectedClampIteration);
-  let delta = performance.now() - start;
+  let stop = performance.now();
+  let delta = stop - start;
 
-  ok(delta >= clampDelayMS, "setTimeout() chain clamped");
+  ok(delta >= clampDelayMS, "setTimeout() chain clamped: " + stop + " - " + start + " = " + delta);
   ok(delta < (2*clampDelayMS), "setTimeout() chain did not clamp twice");
 
   await clearNestingLevel();
 
   // Verify setInterval() clamps correctly
   start = performance.now();
   await delayByInterval(expectedClampIteration);
-  delta = performance.now() - start;
+  stop = performance.now();
+  delta = stop - start;
 
-  ok(delta >= clampDelayMS, "setInterval() clamped");
+  ok(delta >= clampDelayMS, "setInterval() clamped: " + stop + " - " + start + " = " + delta);
   ok(delta < (2*clampDelayMS), "setInterval() did not clamp twice");
 
   await clearNestingLevel();
 
   // Verfy a setTimeout() chain will continue to clamp past the first
   // expected iteration.
   const expectedDelay = (1 + expectedClampIteration) * clampDelayMS;
 
   start = performance.now();
   await delayByTimeoutChain(2 * expectedClampIteration);
-  delta = performance.now() - start;
+  stop = performance.now();
+  delta = stop - start;
 
-  ok(delta >= expectedDelay, "setTimeout() chain continued to clamp");
+  ok(delta >= expectedDelay, "setTimeout() chain continued to clamp: " + stop + " - " + start + " = " + delta);
 
   await clearNestingLevel();
 
   // Verfy setInterval() will continue to clamp past the first expected
   // iteration.
   start = performance.now();
   await delayByTimeoutChain(2 * expectedClampIteration);
-  delta = performance.now() - start;
+  stop = performance.now();
+  delta = stop - start;
 
-  ok(delta >= expectedDelay, "setInterval() continued to clamp");
+  ok(delta >= expectedDelay, "setInterval() continued to clamp: " + stop + " - " + start + " = " + delta);
 
   SimpleTest.finish();
 }
 
-SpecialPowers.pushPrefEnv({ 'set': [["dom.min_timeout_value", clampDelayMS]]},
-                          runTests);
+// It appears that it's possible to get unlucky with time jittering and fail this test.
+// If start is jittered upwards, everything executes very quickly, and delta has
+// a very high midpoint, we may have taken between 10 and 10.002 seconds to execute; but
+// it will appear to be 9.998. Turn off jitter (and add logging) to test this.
+SpecialPowers.pushPrefEnv({ 'set': [
+  ["dom.min_timeout_value", clampDelayMS],
+  ["privacy.resistFingerprinting.reduceTimerPrecision.jitter", false],
+  ]}, runTests);
 </script>
 
 </body>
 </html>