diff --git a/dom/base/test/file_timer_flood.html b/dom/base/test/file_timer_flood.html index dc729d7e4214..94647d1750bf 100644 --- a/dom/base/test/file_timer_flood.html +++ b/dom/base/test/file_timer_flood.html @@ -3,15 +3,25 @@ diff --git a/dom/base/test/test_timer_flood.html b/dom/base/test/test_timer_flood.html index b74b04cf2983..8dfe59316067 100644 --- a/dom/base/test/test_timer_flood.html +++ b/dom/base/test/test_timer_flood.html @@ -20,15 +20,24 @@ function onLoad() { }); } +function setPrefs() { + // Put timeouts randomly in the tracking or normal buffer. We do this in order to + // test to ensure that by default, this will not change the scheduling of timeouts. + return SpecialPowers.pushPrefEnv({"set": [["dom.timeout_bucketing_strategy", 3]]}); +} + // Create a frame that executes a timer flood. The frame signals // that is ready once the flood has had a chance to warm up. function withFloodFrame() { - return new Promise(resolve => { + return new Promise((resolve, reject) => { let frame = document.createElement('iframe'); addEventListener('message', function onMsg(evt) { if (evt.data === 'STARTED') { removeEventListener('message', onMsg); resolve(frame); + } else if (evt.data == 'OUT_OF_ORDER') { + ok(false, "Out of order timeout observed"); + reject(); } }); frame.src = 'file_timer_flood.html'; @@ -75,7 +84,9 @@ function testRequestAnimationFrame() { let floodFrame; -onLoad().then(_ => { +onLoad() +.then(setPrefs) +.then(_ => { // Start a timer flood in a frame. return withFloodFrame(); }).then(frame => { @@ -109,6 +120,8 @@ onLoad().then(_ => { ok(true, 'completed tests without timing out'); floodFrame.remove(); SimpleTest.finish(); +}).catch(_ => { + SimpleTest.finish(); });