test_assert_about_page_no_csp.html (1003B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug 1490977: Test Assertion if content privileged about: page has no CSP</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 <body> 9 <iframe id="testframe"></iframe> 10 <script class="testbody" type="text/javascript"> 11 12 // Test Setup: The test overrules the allowlist of about: pages that are allowed to load 13 // without a CSP and makes sure to hit the assertion within AssertAboutPageHasCSP(). 14 15 SpecialPowers.setBoolPref("dom.security.skip_about_page_csp_allowlist_and_assert", true); 16 17 SimpleTest.waitForExplicitFinish(); 18 SimpleTest.expectAssertions(0, 1); 19 20 ok(true, "sanity: prefs flipped and test runs"); 21 let myFrame = document.getElementById("testframe"); 22 myFrame.src = "about:blank"; 23 // booom :-) 24 25 SpecialPowers.setBoolPref("dom.security.skip_about_page_csp_allowlist_and_assert", false); 26 SimpleTest.finish(); 27 </script> 28 </pre> 29 </body> 30 </html>