/** 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, "url(\"http://example.org/tests/layout/style/test/post-redirect-1.css?1\")", "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, "url(\"http://example.org/tests/layout/style/test/post-redirect-2.css?1\")", "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, "url(\"http://example.org/tests/layout/style/test/post-redirect-3.css?1\")", "Redirect 3 did not get right base URI");
is(ruleList[0].styleSheet.href, redirHrefBase + "redirect-1.css", "Unexpected href for imported sheet");
todo_is(ruleList[0].href, redirHrefBase + "redirect-1.css", "Rule href should be absolute");
is(ruleList[1].styleSheet.href, redirHrefBase + "redirect-2.css", "Unexpected href for imported sheet");
todo_is(ruleList[1].href, redirHrefBase + "redirect-2.css", "Rule href should be absolute");
is($("b").href, "http://example.com/", "Unexpected href one");
is($("b").href, $("b").sheet.href, "Should have the same href when not redirecting");
is($("c").href, redirHrefBase + "redirect-2.css", "Unexpected href two");
is($("c").href, $("c").sheet.href, "Should have the same href when redirecting");
is($("d").href, redirHrefBase + "redirect-3.css", "Unexpected href three");
is($("d").href, $("d").sheet.href, "Should have the same href when redirecting again");
})