| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Cross-origin CSS</title> | 4 <title>Same-origin CSS</title> |
| 5 | 5 |
| 6 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
| 8 | 8 |
| 9 <link rel="stylesheet" | 9 <link rel="stylesheet" |
| 10 href="resources/redir.php?url=http://localhost:8000/security/resources/xor
igincss1.html"></link> | 10 href="resources/redir.php?url=/security/resources/xorigincss1.html"></link
> |
| 11 <link rel="stylesheet" | 11 <link rel="stylesheet" |
| 12 type="text/css" | 12 type="text/css" |
| 13 href="resources/redir.php?url=http://localhost:8000/security/resources/xor
igincss2.html"></link> | 13 href="resources/redir.php?url=/security/resources/xorigincss2.html"></link
> |
| 14 <link rel="stylesheet" | 14 <link rel="stylesheet" |
| 15 href="resources/redir.php?url=http://localhost:8000/security/resources/xor
igincss1.css"></link> | 15 href="resources/redir.php?url=/security/resources/xorigincss1.css"></link> |
| 16 <link rel="stylesheet" | 16 <link rel="stylesheet" |
| 17 href="resources/xorigincss3.html"></link> | 17 href="resources/xorigincss3.html"></link> |
| 18 <style> | 18 <style> |
| 19 /* Deliberately reuse the same file / class / id on this first one */ | 19 /* Deliberately reuse the same file / class / id on this first one */ |
| 20 @import "resources/redir.php?url=http://localhost:8000/security/resources/xorigi
ncss2.html"; | 20 @import "resources/redir.php?url=/security/resources/xorigincss2.html"; |
| 21 @import "resources/redir.php?url=http://localhost:8000/security/resources/xorigi
ncss4.html"; | 21 @import "resources/redir.php?url=/security/resources/xorigincss4.html"; |
| 22 @import "resources/redir.php?url=http://localhost:8000/security/resources/xorigi
ncss7.html"; | 22 @import "resources/redir.php?url=/security/resources/xorigincss7.html"; |
| 23 @import "resources/redir.php?url=http://localhost:8000/security/resources/xorigi
ncss2.css"; | 23 @import "resources/redir.php?url=/security/resources/xorigincss2.css"; |
| 24 @import "resources/xorigincss5.html"; | 24 @import "resources/xorigincss5.html"; |
| 25 | 25 |
| 26 /* Check that data: is still allowed for non-CORS cross-origin image fetches. */ | 26 /* Check that data: is still allowed for non-CORS cross-origin image fetches. */ |
| 27 #data-background-url { | 27 #data-background-url { |
| 28 content: "PASS (image loaded)"; | 28 content: "PASS (image loaded)"; |
| 29 background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/
svg' width='0px' height='0px'></svg>"); | 29 background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/
svg' width='0px' height='0px'></svg>"); |
| 30 } | 30 } |
| 31 </style> | 31 </style> |
| 32 <script> | 32 <script> |
| 33 function getBackgroundColorForId(id) { | 33 function getBackgroundColorForId(id) { |
| 34 return window.getComputedStyle(document.getElementById(id), null).getPro
pertyValue('background-color') | 34 return window.getComputedStyle(document.getElementById(id), null).getPro
pertyValue('background-color') |
| 35 } | 35 } |
| 36 var onloadTest = async_test("Testing cross-origin and MIME behavior for CSS.
"); | 36 var onloadTest = async_test("Testing same-origin and MIME behavior for CSS."
); |
| 37 window.onload = function () { | 37 window.onload = function () { |
| 38 test(function () { | 38 test(function () { |
| 39 assert_equals(getBackgroundColorForId('id1'), 'rgba(0, 0, 0, 0)'); | 39 assert_equals(getBackgroundColorForId('id1'), 'rgba(0, 0, 0, 0)'); |
| 40 }, 'xorigincss1.html should not be loaded via <link>.'); | 40 }, 'xorigincss1.html should not be loaded via <link>.'); |
| 41 test(function () { | 41 test(function () { |
| 42 assert_equals(getBackgroundColorForId('id2'), 'rgba(0, 0, 0, 0)'); | 42 assert_equals(getBackgroundColorForId('id2'), 'rgba(0, 0, 0, 0)'); |
| 43 }, 'xorigincss2.html should not be loaded either via <link> or @import.'
); | 43 }, 'xorigincss2.html should not be loaded either via <link> or @import.'
); |
| 44 test(function () { | 44 test(function () { |
| 45 assert_equals(getBackgroundColorForId('id3'), 'rgb(255, 255, 0)'); | 45 assert_equals(getBackgroundColorForId('id3'), 'rgb(255, 255, 0)'); |
| 46 }, 'xorigincss1.css should be loaded via <link>'); | 46 }, 'xorigincss1.css should be loaded via <link>'); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 <div id="id2" class="id2"></div> | 68 <div id="id2" class="id2"></div> |
| 69 <div id="id3" class="id3"></div> | 69 <div id="id3" class="id3"></div> |
| 70 <div id="id4" class="id4"></div> | 70 <div id="id4" class="id4"></div> |
| 71 <div id="id5" class="id5"></div> | 71 <div id="id5" class="id5"></div> |
| 72 <div id="id6" class="id6"></div> | 72 <div id="id6" class="id6"></div> |
| 73 <div id="id7" class="id7"></div> | 73 <div id="id7" class="id7"></div> |
| 74 <div id="id8" class="id8"></div> | 74 <div id="id8" class="id8"></div> |
| 75 <div id="data-background-url">PASS background image loaded</div> | 75 <div id="data-background-url">PASS background image loaded</div> |
| 76 </body> | 76 </body> |
| 77 </html> | 77 </html> |
| OLD | NEW |