Bug 1058451 - Intermittent test_CSP_bug885433.html | Inline script should be allowed - Result logged after SimpleTest.finish(). r=sstamm, a=test-only
--- a/content/base/test/csp/test_CSP_bug885433.html
+++ b/content/base/test/csp/test_CSP_bug885433.html
@@ -29,16 +29,19 @@ function checkAllowed () {
var color;
color = window.getComputedStyle(cspframe.contentDocument.getElementById('unsafe-inline-script-allowed')).color;
ok(color === green, "Inline script should be allowed");
color = window.getComputedStyle(cspframe.contentDocument.getElementById('unsafe-eval-script-allowed')).color;
ok(color === green, "Eval should be allowed");
color = window.getComputedStyle(cspframe.contentDocument.getElementById('unsafe-inline-style-allowed')).color;
ok(color === green, "Inline style should be allowed");
+
+ document.getElementById('cspframe2').src = 'file_CSP_bug885433_blocks.html';
+ document.getElementById('cspframe2').addEventListener('load', checkBlocked, false);
}
function checkBlocked () {
var cspframe = document.getElementById('cspframe2');
var color;
color = window.getComputedStyle(cspframe.contentDocument.getElementById('unsafe-inline-script-blocked')).color;
ok(color === black, "Inline script should be blocked");
@@ -47,14 +50,12 @@ function checkBlocked () {
color = window.getComputedStyle(cspframe.contentDocument.getElementById('unsafe-inline-style-blocked')).color;
ok(color === black, "Inline style should be blocked");
SimpleTest.finish();
}
document.getElementById('cspframe').src = 'file_CSP_bug885433_allows.html';
document.getElementById('cspframe').addEventListener('load', checkAllowed, false);
-document.getElementById('cspframe2').src = 'file_CSP_bug885433_blocks.html';
-document.getElementById('cspframe2').addEventListener('load', checkBlocked, false);
</script>
</pre>
</body>
</html>