Bug 931169 - waitForCondition should guard the condition evaluation. r=dkeeler

--HG--
extra : rebase_source : 13b3ba78cccf9e4f6e25ec305f2def2a59a41c74
This commit is contained in:
Jared Wein 2013-10-25 17:48:05 -04:00
parent 20557c91d0
commit adf46fac55
5 changed files with 24 additions and 38 deletions

View File

@ -179,18 +179,3 @@ function MixedTest6D() {
ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 6");
MixedTestsCompleted();
}
function waitForCondition(condition, nextTest, errorMsg) {
var tries = 0;
var interval = setInterval(function() {
if (tries >= 30) {
ok(false, errorMsg);
moveOn();
}
if (condition()) {
moveOn();
}
tries++;
}, 100);
var moveOn = function() { clearInterval(interval); nextTest(); };
}

View File

@ -41,26 +41,6 @@ function cleanUpAfterTests() {
window.focus();
finish();
}
/*
* Whenever we disable the Mixed Content Blocker of the page
* we have to make sure that our condition is properly loaded.
*/
function waitForCondition(condition, nextTest, errorMsg) {
var tries = 0;
var interval = setInterval(function() {
if (tries >= 30) {
ok(false, errorMsg);
moveOn();
}
if (condition()) {
moveOn();
}
tries++;
}, 100);
var moveOn = function() {
clearInterval(interval); nextTest();
};
}
//------------------------ Test 1 ------------------------------

View File

@ -89,7 +89,14 @@ function waitForCondition(condition, nextTest, errorMsg) {
ok(false, errorMsg);
moveOn();
}
if (condition()) {
var conditionPassed;
try {
conditionPassed = condition();
} catch (e) {
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;

View File

@ -18,7 +18,14 @@ function waitForCondition(condition, nextTest, errorMsg) {
ok(false, errorMsg);
moveOn();
}
if (condition()) {
var conditionPassed;
try {
conditionPassed = condition();
} catch (e) {
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;

View File

@ -1241,7 +1241,14 @@ function waitForCondition(condition, nextTest, errorMsg) {
ok(false, errorMsg);
moveOn();
}
if (condition()) {
var conditionPassed;
try {
conditionPassed = condition();
} catch (e) {
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;