diff options
Diffstat (limited to 'toolkit/content/tests/widgets/head.js')
-rw-r--r-- | toolkit/content/tests/widgets/head.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/toolkit/content/tests/widgets/head.js b/toolkit/content/tests/widgets/head.js new file mode 100644 index 000000000..c2ae0c7ae --- /dev/null +++ b/toolkit/content/tests/widgets/head.js @@ -0,0 +1,23 @@ +"use strict"; + +function waitForCondition(condition, nextTest, errorMsg) { + var tries = 0; + var interval = setInterval(function() { + if (tries >= 30) { + ok(false, errorMsg); + moveOn(); + } + var conditionPassed; + try { + conditionPassed = condition(); + } catch (e) { + ok(false, e + "\n" + e.stack); + conditionPassed = false; + } + if (conditionPassed) { + moveOn(); + } + tries++; + }, 100); + var moveOn = function() { clearInterval(interval); nextTest(); }; +} |