mirror of
https://github.com/servo/servo.git
synced 2025-08-14 18:05:36 +01:00
Support origins in CSSOM stylesheets
This commit is contained in:
parent
655a9fd7ce
commit
fd950a7309
8 changed files with 103 additions and 9 deletions
|
@ -45865,6 +45865,12 @@
|
|||
"url": "/cssom/overflow-serialization.html"
|
||||
}
|
||||
],
|
||||
"cssom/stylesheet-same-origin.sub.html": [
|
||||
{
|
||||
"path": "cssom/stylesheet-same-origin.sub.html",
|
||||
"url": "/cssom/stylesheet-same-origin.sub.html"
|
||||
}
|
||||
],
|
||||
"html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html": [
|
||||
{
|
||||
"path": "html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
padding: 10px;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSOM - CSSStylesheet should support origins</title>
|
||||
<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">
|
||||
|
||||
<script>
|
||||
var crossorigin = document.getElementById("crossorigin").sheet;
|
||||
var sameorigin = document.getElementById("sameorigin").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");
|
||||
|
||||
test(function() {
|
||||
assert_equals(sameorigin.cssRules.length, 1, "Same origin stylesheet.cssRules should be accessible.");
|
||||
sameorigin.insertRule("#test { margin: 10px; }", 1);
|
||||
assert_equals(sameorigin.cssRules.length, 2, "Same origin stylesheet.insertRule should be accessible.");
|
||||
sameorigin.deleteRule(0);
|
||||
assert_equals(sameorigin.cssRules.length, 1, "Same origin stylesheet.deleteRule should be accessible.");
|
||||
}, "Origin-clean check in same-origin CSSOM Stylesheets");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue