« Bugzilla Issues Index

#110 — Tests stop or slow down when tab is in background on Firefox 5 and Chrome 11

I'm currently running the tests, on Firefox 5. When the tab is active, CPU goes up to 50% (I have two cores). When I switch tabs, CPU goes down. Up back when I switch back to the test tab. Same behavior on Chrome 11.

I think that this is due to the recent change on Firefox 5.
On, it can be read that "timeouts are clamped to firing no more often than once per second (1000ms) in inactive tabs".
And indeed, the test loader uses setTimeout:
By the way, is there a reason why 10 is the setTimeout value?

Modern browsers can implement the equivalent of a 0sec timeout using postMessage (

Based on :
var nextTick = (function() {
return function(cb) {
window.onmessage = cb;
window.postMessage('', '*');

As a short term workaround, tabs can be extracted both on Firefox and Chrome to become independent windows. Leaving the test suite tab being the active tab of this new window make tests run fast.