test_asyncopen.html (1397B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1195173 5 --> 6 <head> 7 <title>Bug 1195173 - Test asyncOpen security exception</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 11 <!-- Note: the following stylesheet does not exist --> 12 <link rel="stylesheet" id="myCSS" type="text/css" href="file:///home/foo/bar.css"> 13 14 </head> 15 <body onload="checkCSS()"> 16 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1195173">Mozilla Bug 1195173</a> 17 <p id="display"></p> 18 <div id="content" style="display: none"></div> 19 20 <script type="application/javascript"> 21 /* 22 * Description of the test: 23 * Accessing a stylesheet that got blocked by asyncOpen should 24 * throw an exception. 25 */ 26 27 SimpleTest.waitForExplicitFinish(); 28 29 function checkCSS() 30 { 31 try { 32 // accessing tests/SimpleTest/test.css should not throw 33 var goodCSS = document.styleSheets[0].cssRules 34 ok(true, "accessing test.css should be allowed"); 35 } 36 catch(e) { 37 ok(false, "accessing test.css should be allowed"); 38 } 39 40 try { 41 // accessing file:///home/foo/bar.css should throw 42 var badCSS = document.styleSheets[1].cssRules 43 ok(false, "accessing bar.css should throw"); 44 } 45 catch(e) { 46 ok(true, "accessing bar.css should throw"); 47 } 48 49 SimpleTest.finish(); 50 } 51 52 </script> 53 </body> 54 </html>