layout/style/test/test_bug221428.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial