| Index: LayoutTests/http/tests/security/cross-origin-css.html
|
| diff --git a/LayoutTests/http/tests/security/cross-origin-css.html b/LayoutTests/http/tests/security/cross-origin-css.html
|
| index 3f35232e9a3a6f418ab70fd469eb6f3d0185747a..4cca0b685a851881d43bc2047a00dd72e2f45903 100644
|
| --- a/LayoutTests/http/tests/security/cross-origin-css.html
|
| +++ b/LayoutTests/http/tests/security/cross-origin-css.html
|
| @@ -1,5 +1,12 @@
|
| +<!DOCTYPE html>
|
| <html>
|
| <head>
|
| +<title>Cross-origin CSS</title>
|
| +
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +
|
| +<!-- Bring in various same- and cross-origin stylesheets. -->
|
| <link rel="stylesheet"
|
| href="resources/redir.php?url=http://localhost:8000/security/resources/xorigincss1.html"></link>
|
| <link rel="stylesheet"
|
| @@ -9,32 +16,7 @@
|
| href="resources/redir.php?url=http://localhost:8000/security/resources/xorigincss1.css"></link>
|
| <link rel="stylesheet"
|
| href="resources/xorigincss3.html"></link>
|
| -<script>
|
| -if (window.testRunner) {
|
| - testRunner.waitUntilDone();
|
| - testRunner.dumpAsText();
|
| -}
|
|
|
| -window.onload = function() {
|
| - ele = document.getElementById("id1");
|
| - ele.innerText = "LINK Cross-origin, HTML, valid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| - ele = document.getElementById("id2");
|
| - ele.innerText = "LINK + IMPORT Cross-origin, HTML, invalid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| - ele = document.getElementById("id3");
|
| - ele.innerText = "LINK Cross-origin, CSS, invalid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| - ele = document.getElementById("id4");
|
| - ele.innerText = "LINK Same-origin, HTML, invalid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| - ele = document.getElementById("id5");
|
| - ele.innerText = "IMPORT Cross-origin, HTML, valid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| - ele = document.getElementById("id6");
|
| - ele.innerText = "IMPORT Cross-origin, CSS, invalid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| - ele = document.getElementById("id7");
|
| - ele.innerText = "IMPORT Same-origin, HTML, invalid: " + window.getComputedStyle(ele, null).getPropertyValue('background-color');
|
| -
|
| - if (window.testRunner)
|
| - testRunner.notifyDone();
|
| -}
|
| -</script>
|
| <style>
|
| /* Deliberately reuse the same file / class / id on this first one */
|
| @import "resources/redir.php?url=http://localhost:8000/security/resources/xorigincss2.html";
|
| @@ -48,6 +30,54 @@ window.onload = function() {
|
| background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='0px' height='0px'></svg>");
|
| }
|
| </style>
|
| +<script>
|
| +function getBackgroundColorForId(id) {
|
| + return window.getComputedStyle(document.getElementById(id), null).getPropertyValue('background-color')
|
| +}
|
| +
|
| +var onloadTest = async_test("Testing cross-origin and MIME behavior for CSS.");
|
| +
|
| +window.onload = function () {
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id1'), 'rgba(0, 0, 0, 0)');
|
| + }, 'xorigincss1.html should not be loaded via <link>.');
|
| +
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id2'), 'rgba(0, 0, 0, 0)');
|
| + }, 'xorigincss2.html should not be loaded either via <link> or @import.');
|
| +
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id3'), 'rgb(255, 255, 0)');
|
| + }, 'xorigincss1.css should be loaded via <link>');
|
| +
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id4'), 'rgba(0, 0, 0, 0)');
|
| + }, 'xorigincss3.html should not be loaded, even though it is same-origin');
|
| +
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id5'), 'rgba(0, 0, 0, 0)');
|
| + }, 'xorigincss4.html should not be loaded via @import.');
|
| +
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id6'), 'rgb(255, 255, 0)');
|
| + }, 'xorigincss2.css should be loaded.');
|
| +
|
| + test(function () {
|
| + assert_equals(getBackgroundColorForId('id7'), 'rgba(0, 0, 0, 0)');
|
| + }, 'xorigincss5.html should not be loaded.');
|
| +
|
| + onloadTest.done();
|
| +};
|
| +</script>
|
| </head>
|
| -<body><div id="id1" class="id1"></div><div id="id2" class="id2"></div><div id="id3" class="id3"></div><div id="id4" class="id4"></div><div id="id5" class="id5"></div><div id="id6" class="id6"></div><div id="id7" class="id7"></div><div id="data-background-url">PASS background image loaded</div></body>
|
| +<body>
|
| + <div id="id1" class="id1"></div>
|
| + <div id="id2" class="id2"></div>
|
| + <div id="id3" class="id3"></div>
|
| + <div id="id4" class="id4"></div>
|
| + <div id="id5" class="id5"></div>
|
| + <div id="id6" class="id6"></div>
|
| + <div id="id7" class="id7"></div>
|
| + <div id="data-background-url">PASS background image loaded</div>
|
| +</body>
|
| </html>
|
|
|