block-mime-as-script.html (1447B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Block mime type as script</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div></div> 7 <script> 8 var noop = function() {}; 9 10 ["non-empty", "empty"].forEach(function(content) { 11 ["text/csv", 12 "audio/aiff", 13 "audio/midi", 14 "audio/whatever", 15 "video/avi", 16 "video/fli", 17 "video/whatever", 18 "image/jpeg", 19 "image/gif", 20 "image/whatever"].forEach(function(test_case) { 21 async_test(function(t) { 22 var script = document.createElement("script"); 23 script.onerror = t.step_func_done(noop); 24 script.onload = t.unreached_func("Unexpected load event"); 25 script.src = "../resources/script-with-header.py?content=" + content + 26 "&mime=" + test_case; 27 document.body.appendChild(script); 28 }, "Should fail loading " + content + " script with " + test_case + 29 " MIME type"); 30 }); 31 }); 32 33 ["html", "plain"].forEach(function(test_case) { 34 async_test(function(t) { 35 var script = document.createElement("script"); 36 script.onerror = t.unreached_func("Unexpected error event"); 37 script.onload = t.step_func_done(noop); 38 script.src = "../resources/script-with-header.py?mime=text/" + test_case; 39 document.body.appendChild(script); 40 }, "Should load script with text/" + test_case + " MIME type"); 41 }); 42 43 </script>