mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Automatic update from web-platform-testsAdd and correct CSSOM spec references Many CSSOM tests were missing spec references or had incorrect ones; add/update these references. -- Move GetBoundingRect.html getBoundingClientRec is defined in CSSOM View, not CSSOM. wpt-commits: 825f054d0d8f1f60ef13e36b46d6ea97ea87cc15, b52a19067b803b35f9cdd588f8302a289e20446a wpt-pr: 10005 wpt-commits: 825f054d0d8f1f60ef13e36b46d6ea97ea87cc15, b52a19067b803b35f9cdd588f8302a289e20446a wpt-pr: 10005
58 lines
2.4 KiB
HTML
58 lines
2.4 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>CSSOM - CSSStylesheet should support origins</title>
|
|
<link rel="help" href="https://drafts.csswg.org/cssom/#the-cssstylesheet-interface">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
|
|
<link id="crossorigin" href="http://www1.{{host}}:{{ports[http][1]}}/stylesheet-same-origin.css" rel="stylesheet">
|
|
<link id="sameorigin" href="stylesheet-same-origin.css" rel="stylesheet">
|
|
<link id="sameorigindata" href="data:text/css,.green-text{color:rgb(0, 255, 0)}" rel="stylesheet">
|
|
|
|
<script>
|
|
var crossorigin = document.getElementById("crossorigin").sheet;
|
|
var sameorigin = document.getElementById("sameorigin").sheet;
|
|
var sameorigindata = document.getElementById("sameorigindata").sheet;
|
|
|
|
test(function() {
|
|
assert_throws("SecurityError",
|
|
function () {
|
|
crossorigin.cssRules;
|
|
},
|
|
"Cross origin stylesheet.cssRules should throw SecurityError.");
|
|
assert_throws("SecurityError",
|
|
function () {
|
|
crossorigin.insertRule("#test { margin: 10px; }", 1);
|
|
},
|
|
"Cross origin stylesheet.insertRule should throw SecurityError.");
|
|
|
|
assert_throws("SecurityError",
|
|
function () {
|
|
crossorigin.deleteRule(0);
|
|
},
|
|
"Cross origin stylesheet.deleteRule should throw SecurityError.");
|
|
}, "Origin-clean check in cross-origin CSSOM Stylesheets");
|
|
|
|
function doOriginCleanCheck(sheet, name) {
|
|
assert_equals(sheet.cssRules.length, 1, name + " stylesheet.cssRules should be accessible.");
|
|
sheet.insertRule("#test { margin: 10px; }", 1);
|
|
assert_equals(sheet.cssRules.length, 2, name + " stylesheet.insertRule should be accessible.");
|
|
sheet.deleteRule(0);
|
|
assert_equals(sheet.cssRules.length, 1, name + " stylesheet.deleteRule should be accessible.");
|
|
}
|
|
|
|
test(function() {
|
|
doOriginCleanCheck(sameorigin, "Same-origin");
|
|
}, "Origin-clean check in same-origin CSSOM Stylesheets");
|
|
|
|
test(function() {
|
|
doOriginCleanCheck(sameorigindata, "data:css");
|
|
}, "Origin-clean check in data:css CSSOM Stylesheets");
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</html>
|