Bug 487402 - test_dynUnsecureRedirect.html intermittently fails, change timeouts to callbacks where possible, r=kaie, a=test only change/orange fix

This commit is contained in:
Honza Bambas 2010-08-18 19:22:48 +02:00
parent 860a0298a2
commit 8bb7670f7e
5 changed files with 24 additions and 8 deletions

View File

@ -208,3 +208,16 @@ function isSecurityState(expectedState, message, test)
throw "Invalid isSecurityState state";
}
}
function waitForSecurityState(expectedState, callback)
{
var roundsLeft = 200; // Wait for 20 seconds (=200*100ms)
var interval =
window.setInterval(function() {
isSecurityState(expectedState, "", function(isok) {if (isok) {roundsLeft = 0;}});
if (!roundsLeft--) {
window.clearInterval(interval);
callback();
}
}, 100);
}

View File

@ -15,10 +15,11 @@
document.getElementById("para").style.content =
"url('http://example.com/tests/security/ssl/mixedcontent/moonsurface.jpg')";
window.setTimeout(function() {
waitForSecurityState("broken", function()
{
isSecurityState("broken", "insecure content added by styling breaks security");
finish();
}, 500);
});
}
function afterNavigationTest()

View File

@ -18,10 +18,11 @@
"http://example.com/tests/security/ssl/mixedcontent/moonsurface.jpg";
}, 0);
window.setTimeout(function() {
waitForSecurityState("broken", function()
{
isSecurityState("broken", "src='http://...' changed to broken");
finish();
}, 500);
});
}
function afterNavigationTest()

View File

@ -17,10 +17,11 @@
document.body.background =
"http://example.com/tests/security/ssl/mixedcontent/moonsurface.jpg";
window.setTimeout(function() {
waitForSecurityState("broken", function()
{
isSecurityState("broken", "document.body.background='http://...' changed to broken");
finish();
}, 500);
});
}
function afterNavigationTest()

View File

@ -19,11 +19,11 @@
"<img id='image1' src='http://example.com/tests/security/ssl/mixedcontent/moonsurface.jpg' />";
}, 1);
window.setTimeout(function()
waitForSecurityState("broken", function()
{
isSecurityState("broken", "innerHTML loading insecure changed to broken");
finish();
}, 500);
});
}
function afterNavigationTest()