Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / layout / style / test / test_bug397427.html
blobae457215e11aab700eea7abae49a3e920efd35e8
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=397427
5 -->
6 <head>
7 <title>Test for Bug 397427</title>
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 <style id="a">
12 @import url("redirect-1.css");
13 @import url("redirect-2.css");
14 .test { color: red }
15 </style>
16 <link id="b" rel="stylesheet" href="http://example.com">
17 <link id="c" rel="stylesheet" href="redirect-2.css">
18 <link id="d" rel="stylesheet" href="redirect-3.css">
19 </head>
20 <body>
21 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=397427">Mozilla Bug 397427</a>
22 <p id="display">
23 <span id="one" class="test"></span>
24 <span id="two" class="test"></span>
25 <span id="three" class="test"></span>
26 </p>
27 <div id="content" style="display: none">
29 </div>
30 <pre id="test">
31 <script class="testbody" type="text/javascript">
33 /** Test for Bug 397427 **/
34 SimpleTest.waitForExplicitFinish();
36 addLoadEvent(function() {
37 is($("a").sheet.href, null, "href should be null");
38 is(typeof($("a").sheet.href), "object", "should be actual null");
40 // Make sure the redirected sheets are loaded and have the right base URI
41 is(document.defaultView.getComputedStyle($("one"), "").color,
42 "rgb(0, 128, 0)", "Redirect 1 did not work");
43 is(document.defaultView.getComputedStyle($("one"), "").backgroundImage,
44 "url(http://example.org/tests/layout/style/test/post-redirect-1.css#)",
45 "Redirect 1 did not get right base URI");
46 is(document.defaultView.getComputedStyle($("two"), "").color,
47 "rgb(0, 128, 0)", "Redirect 2 did not work");
48 is(document.defaultView.getComputedStyle($("two"), "").backgroundImage,
49 "url(http://example.org/tests/layout/style/test/post-redirect-2.css#)",
50 "Redirect 2 did not get right base URI");
51 is(document.defaultView.getComputedStyle($("three"), "").color,
52 "rgb(0, 128, 0)", "Redirect 3 did not work");
53 is(document.defaultView.getComputedStyle($("three"), "").backgroundImage,
54 "url(http://example.org/tests/layout/style/test/post-redirect-3.css#)",
55 "Redirect 3 did not get right base URI");
57 var ruleList = $("a").sheet.cssRules;
59 is(ruleList[0].styleSheet.href,
60 window.location.href.replace(/test_bug397427.html$/, "redirect-1.css"),
61 "Unexpected href for imported sheet");
62 todo(ruleList[0].href == window.location.href.replace(/test_bug397427.html$/, "redirect-1.css"),
63 "Rule href should be absolute");
64 is(ruleList[1].styleSheet.href,
65 window.location.href.replace(/test_bug397427.html$/, "redirect-2.css"),
66 "Unexpected href for imported sheet");
67 todo(ruleList[1].href == window.location.href.replace(/test_bug397427.html$/, "redirect-2.css"),
68 "Rule href should be absolute");
70 is($("b").href, "http://example.com/", "Unexpected href one");
71 is($("b").href, $("b").sheet.href,
72 "Should have the same href when not redirecing");
74 is($("c").href,
75 window.location.href.replace(/test_bug397427.html$/, "redirect-2.css"),
76 "Unexpected href two");
77 is($("c").href, $("c").sheet.href,
78 "Should have the same href when redirecting");
80 is($("d").href,
81 window.location.href.replace(/test_bug397427.html$/, "redirect-3.css"),
82 "Unexpected href three");
83 is($("d").href, $("d").sheet.href,
84 "Should have the same href when redirecting again");
87 addLoadEvent(SimpleTest.finish);
88 </script>
89 </pre>
90 </body>
91 </html>