test_bug221428.html (1879B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=221428 5 --> 6 <head> 7 <title>Test for Bug 221428</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 <link rel="stylesheet" href="data:text/css,body { color: green; }"> 11 <style> 12 @import url("data:text/css,body { border: 1px solid transparent; }"); 13 body { color: black; } 14 </style> 15 <script> 16 var executed = false; 17 </script> 18 <link rel="stylesheet" href="javascript:executed = true;"> 19 </head> 20 <body> 21 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=221428">Mozilla Bug 221428</a> 22 <p id="display"></p> 23 <div id="content" style="display: none"> 24 25 </div> 26 <pre id="test"> 27 <script class="testbody" type="text/javascript"> 28 29 /** Test for Bug 221428 */ 30 31 var exceptionThrown = false; 32 try { 33 is(document.styleSheets[1].cssRules[0].cssText, "body { color: green; }", 34 "Should get the color: green rule back"); 35 } catch (e) { 36 exceptionThrown = true; 37 } 38 39 ok(!exceptionThrown, "Should be able to access data: <link> stylesheet"); 40 41 exceptionThrown = false; 42 try { 43 is(document.styleSheets[2].cssRules[1].cssText, "body { color: black; }", 44 "Should get the color: black rule back"); 45 } catch (e) { 46 exceptionThrown = true; 47 } 48 ok(!exceptionThrown, "Should be able to access <style> stylesheet"); 49 50 exceptionThrown = false; 51 try { 52 is(document.styleSheets[2].cssRules[0].styleSheet.cssRules[0].cssText, 53 "body { border: 1px solid transparent; }", 54 "Should get the 'border: 1px solid transparent' rule back"); 55 } catch (e) { 56 exceptionThrown = true; 57 } 58 ok(!exceptionThrown, "Should be able to access data: @import stylesheet"); 59 60 ok(!executed, 61 "Shouldn't be executing stylesheet-link javascript: URIs against " + 62 "the page context"); 63 64 </script> 65 </pre> 66 </body> 67 </html>