stylesheet.html (1929B)
1 <!-- quirks mode is important, text/css is already required otherwise --> 2 <script src=/resources/testharness.js></script> 3 <script src=/resources/testharnessreport.js></script> 4 <div id=log></div> 5 <script> 6 var fails = [null, "", "x", "x/x", "text/html", "text/json"], 7 passes = ["text/css", "text/css;charset=utf-8", "text/css;blah"] 8 9 const get_url = (mime) => { 10 let url = "resources/css.py" 11 if (mime != null) { 12 url += "?type=" + encodeURIComponent(mime) 13 } 14 return url 15 } 16 17 fails.forEach(function(mime) { 18 async_test(function(t) { 19 var link = document.createElement("link") 20 link.rel = "stylesheet" 21 link.onerror = t.step_func_done() 22 link.onload = t.unreached_func("Unexpected load event") 23 link.href = get_url(mime) 24 document.body.appendChild(link) 25 }, "URL query: " + mime) 26 }) 27 28 fails.forEach(function(mime) { 29 async_test(function(t) { 30 var link = document.createElement("link") 31 link.rel = "stylesheet" 32 link.onerror = t.step_func_done() 33 link.onload = t.unreached_func("Unexpected load event") 34 link.href = get_url(mime) 35 document.body.appendChild(link) 36 }, "Revalidated URL query: " + mime) 37 }) 38 39 passes.forEach(function(mime) { 40 async_test(function(t) { 41 var link = document.createElement("link") 42 link.rel = "stylesheet" 43 link.onerror = t.unreached_func("Unexpected error event") 44 link.onload = t.step_func_done() 45 link.href = get_url(mime) 46 document.body.appendChild(link) 47 }, "URL query: " + mime) 48 }) 49 50 passes.forEach(function(mime) { 51 async_test(function(t) { 52 var link = document.createElement("link") 53 link.rel = "stylesheet" 54 link.onerror = t.unreached_func("Unexpected error event") 55 link.onload = t.step_func_done() 56 link.href = get_url(mime) 57 document.body.appendChild(link) 58 }, "Revalidated URL query: " + mime) 59 }) 60 </script>