Bug 1058451 - Intermittent test_CSP_bug885433.html | Inline script should be allowed - Result logged after SimpleTest.finish(). r=sstamm
authorMartijn Wargers <mwargers@mozilla.com>
Tue, 26 Aug 2014 17:59:42 +0200
changeset 202234 c16359660b11f4a61d701056ac109d81f7e07a8a
parent 202233 ebe3f3603f563ff7eef7ee9e97b2fb633b5c2788
child 202235 0dca174fbc10b7a5b4620fd259670c95c97ed338
push idunknown
push userunknown
push dateunknown
reviewerssstamm
bugs1058451, 885433
milestone34.0a1
Bug 1058451 - Intermittent test_CSP_bug885433.html | Inline script should be allowed - Result logged after SimpleTest.finish(). r=sstamm
content/base/test/csp/test_CSP_bug885433.html
--- 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>