1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_bug221428.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,68 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=221428 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 221428</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 + <link rel="stylesheet" href="data:text/css,body { color: green; }"> 1.14 + <style> 1.15 + @import url("data:text/css,body { border: 1px solid transparent; }"); 1.16 + body { color: black; } 1.17 + </style> 1.18 + <script> 1.19 + var executed = false; 1.20 + </script> 1.21 + <link rel="stylesheet" href="javascript:executed = true;"> 1.22 +</head> 1.23 +<body> 1.24 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=221428">Mozilla Bug 221428</a> 1.25 +<p id="display"></p> 1.26 +<div id="content" style="display: none"> 1.27 + 1.28 +</div> 1.29 +<pre id="test"> 1.30 +<script class="testbody" type="text/javascript"> 1.31 + 1.32 +/** Test for Bug 221428 **/ 1.33 + 1.34 +var exceptionThrown = false; 1.35 +try { 1.36 + is(document.styleSheets[1].cssRules[0].cssText, "body { color: green; }", 1.37 + "Should get the color: green rule back"); 1.38 +} catch (e) { 1.39 + exceptionThrown = true; 1.40 +} 1.41 + 1.42 +ok(!exceptionThrown, "Should be able to access data: <link> stylesheet"); 1.43 + 1.44 +exceptionThrown = false; 1.45 +try { 1.46 + is(document.styleSheets[2].cssRules[1].cssText, "body { color: black; }", 1.47 + "Should get the color: black rule back"); 1.48 +} catch (e) { 1.49 + exceptionThrown = true; 1.50 +} 1.51 +ok(!exceptionThrown, "Should be able to access <style> stylesheet"); 1.52 + 1.53 +exceptionThrown = false; 1.54 +try { 1.55 + is(document.styleSheets[2].cssRules[0].styleSheet.cssRules[0].cssText, 1.56 + "body { border: 1px solid transparent; }", 1.57 + "Should get the 'border: 1px solid transparent' rule back"); 1.58 +} catch (e) { 1.59 + exceptionThrown = true; 1.60 +} 1.61 +ok(!exceptionThrown, "Should be able to access data: @import stylesheet"); 1.62 + 1.63 +ok(!executed, 1.64 + "Shouldn't be executing stylesheet-link javascript: URIs against " + 1.65 + "the page context"); 1.66 + 1.67 +</script> 1.68 +</pre> 1.69 +</body> 1.70 +</html> 1.71 +