2007-10-23 14:56:41 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=397427
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 397427</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2007-10-23 14:56:41 -07:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
<style id="a">
|
2009-12-23 10:01:51 -08:00
|
|
|
@import url("redirect.sjs?http://example.org/tests/layout/style/test/post-redirect-1.css");
|
|
|
|
@import url("redirect.sjs?http://example.org/tests/layout/style/test/post-redirect-2.css");
|
2007-10-23 14:56:41 -07:00
|
|
|
.test { color: red }
|
|
|
|
</style>
|
|
|
|
<link id="b" rel="stylesheet" href="http://example.com">
|
2009-12-23 10:01:51 -08:00
|
|
|
<link id="c" rel="stylesheet" href="redirect.sjs?http://example.org/tests/layout/style/test/post-redirect-2.css">
|
|
|
|
<link id="d" rel="stylesheet" href="redirect.sjs?http://example.org/tests/layout/style/test/post-redirect-3.css">
|
2007-10-23 14:56:41 -07:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=397427">Mozilla Bug 397427</a>
|
|
|
|
<p id="display">
|
|
|
|
<span id="one" class="test"></span>
|
|
|
|
<span id="two" class="test"></span>
|
|
|
|
<span id="three" class="test"></span>
|
|
|
|
</p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 397427 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
addLoadEvent(function() {
|
|
|
|
is($("a").sheet.href, null, "href should be null");
|
|
|
|
is(typeof($("a").sheet.href), "object", "should be actual null");
|
|
|
|
|
|
|
|
// Make sure the redirected sheets are loaded and have the right base URI
|
|
|
|
is(document.defaultView.getComputedStyle($("one"), "").color,
|
|
|
|
"rgb(0, 128, 0)", "Redirect 1 did not work");
|
|
|
|
is(document.defaultView.getComputedStyle($("one"), "").backgroundImage,
|
2009-03-05 20:05:01 -08:00
|
|
|
"url(\"http://example.org/tests/layout/style/test/post-redirect-1.css#\")",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Redirect 1 did not get right base URI");
|
|
|
|
is(document.defaultView.getComputedStyle($("two"), "").color,
|
|
|
|
"rgb(0, 128, 0)", "Redirect 2 did not work");
|
|
|
|
is(document.defaultView.getComputedStyle($("two"), "").backgroundImage,
|
2009-03-05 20:05:01 -08:00
|
|
|
"url(\"http://example.org/tests/layout/style/test/post-redirect-2.css#\")",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Redirect 2 did not get right base URI");
|
|
|
|
is(document.defaultView.getComputedStyle($("three"), "").color,
|
|
|
|
"rgb(0, 128, 0)", "Redirect 3 did not work");
|
|
|
|
is(document.defaultView.getComputedStyle($("three"), "").backgroundImage,
|
2009-03-05 20:05:01 -08:00
|
|
|
"url(\"http://example.org/tests/layout/style/test/post-redirect-3.css#\")",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Redirect 3 did not get right base URI");
|
|
|
|
|
|
|
|
var ruleList = $("a").sheet.cssRules;
|
2009-12-23 10:01:51 -08:00
|
|
|
|
|
|
|
var redirHrefBase =
|
|
|
|
window.location.href.replace(/test_bug397427.html$/,
|
|
|
|
"redirect.sjs?http://example.org/tests/layout/style/test/post-");
|
|
|
|
|
|
|
|
is(ruleList[0].styleSheet.href, redirHrefBase + "redirect-1.css",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Unexpected href for imported sheet");
|
2009-12-23 10:01:51 -08:00
|
|
|
todo_is(ruleList[0].href, redirHrefBase + "redirect-1.css",
|
|
|
|
"Rule href should be absolute");
|
|
|
|
is(ruleList[1].styleSheet.href, redirHrefBase + "redirect-2.css",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Unexpected href for imported sheet");
|
2009-12-23 10:01:51 -08:00
|
|
|
todo_is(ruleList[1].href, redirHrefBase + "redirect-2.css",
|
|
|
|
"Rule href should be absolute");
|
2007-10-23 14:56:41 -07:00
|
|
|
|
|
|
|
is($("b").href, "http://example.com/", "Unexpected href one");
|
|
|
|
is($("b").href, $("b").sheet.href,
|
2009-12-23 10:01:51 -08:00
|
|
|
"Should have the same href when not redirecting");
|
2007-10-23 14:56:41 -07:00
|
|
|
|
2009-12-23 10:01:51 -08:00
|
|
|
is($("c").href, redirHrefBase + "redirect-2.css",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Unexpected href two");
|
|
|
|
is($("c").href, $("c").sheet.href,
|
|
|
|
"Should have the same href when redirecting");
|
2009-12-23 10:01:51 -08:00
|
|
|
|
|
|
|
is($("d").href, redirHrefBase + "redirect-3.css",
|
2007-10-23 14:56:41 -07:00
|
|
|
"Unexpected href three");
|
|
|
|
is($("d").href, $("d").sheet.href,
|
|
|
|
"Should have the same href when redirecting again");
|
|
|
|
})
|
|
|
|
|
|
|
|
addLoadEvent(SimpleTest.finish);
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|