| <!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> |