Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: layout/style/test/mochitest.toml
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<meta charset="utf-8">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#content span { color: red; }
#content span.reverse { color: green; }
#content { display: block !important; }
#content span::before { content: attr(id); }
</style>
<link rel="stylesheet"
<link rel="stylesheet"
crossorigin>
<link rel="stylesheet"
crossorigin="use-credentials">
<link rel="stylesheet"
<link rel="stylesheet" id="cross-origin-sheet"
crossorigin>
<link rel="stylesheet"
crossorigin="use-credentials">
<link rel="stylesheet"
<link rel="stylesheet"
crossorigin>
<link rel="stylesheet"
crossorigin="use-credentials">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=732209">Mozilla Bug 732209</a>
<p id="display"></p>
<div id="content" style="display: none">
<span id="one"></span>
<span id="two"></span>
<span id="three"></span>
<span id="four"></span>
<span id="five" class="reverse"></span>
<span id="six" class="reverse"></span>
<span id="seven"></span>
<span id="eight"></span>
<span id="nine" class="reverse"></span>
<span id="ten"></span>
<span id="eleven"></span>
<span id="twelve"></span>
</div>
<pre id="test" style="color: red">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var spans = $("content").querySelectorAll("span");
for (var i = 0; i < spans.length; ++i) {
is(getComputedStyle(spans[i], "").color, "rgb(0, 128, 0)",
"Span " + spans[i].id + " should be green");
}
try {
var sheet = $("cross-origin-sheet").sheet;
dump('aaa\n');
is(sheet.cssRules.length, 2,
"Should be able to get length of list of rules");
is(sheet.cssRules[0].style.color, "green",
"Should be able to read individual rules");
} catch (e) {
ok(false,
"Should be allowed to access cross-origin sheet that opted in with CORS: " + e);
}
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>