style-css-mislabeled-as-html.sub.html (1381B)
1 <!DOCTYPE html> 2 <!-- Test verifies that CORB won't impact a cross-origin stylesheet mislabeled 3 as text/html (because even without CORB mislabeled CSS will be rejected). 4 --> 5 <meta charset="utf-8"> 6 <title>CSS is not applied (because of strict content-type enforcement for cross-origin stylesheets)</title> 7 <script src=/resources/testharness.js></script> 8 <script src=/resources/testharnessreport.js></script> 9 10 <!-- Default style that will be applied if the external stylesheet resource 11 below won't load for any reason. This stylesheet will set h1's 12 color to green (see |default_color| below). --> 13 <style> 14 h1 { color: green; } 15 </style> 16 17 <!-- This stylesheet (if loaded) should set h1#header's color to red 18 (see |external_color| below). --> 19 <!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> 20 <link rel="stylesheet" type="text/css" 21 href="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/css-mislabeled-as-html.css"> 22 23 <body> 24 <h1 id="header">Header example</h1> 25 <p>Paragraph body</p> 26 </body> 27 28 <script> 29 test(() => { 30 let style = getComputedStyle(document.getElementById('header')); 31 const external_color = 'rgb(255, 0, 0)'; // red 32 const default_color = 'rgb(0, 128, 0)'; // green 33 assert_equals(style.getPropertyValue('color'), default_color); 34 assert_not_equals(style.getPropertyValue('color'), external_color); 35 }); 36 </script>