OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <head> | |
3 <title>SRI with bad MIME types are blocked</title> | |
4 <script src="/resources/testharness.js"></script> | |
5 <script src="/resources/testharnessreport.js"></script> | |
6 </head> | |
7 <body> | |
8 <script> | |
9 var test = async_test("Test that scripts with bad MIME types don't l
oad."); | |
10 var result = false; | |
11 var tests = [ | |
12 { | |
13 'src': 'resources/setResultWithMIME.php?mime=application/jav
ascript&value=true', | |
14 'integrity': 'sha256-_CPhHgLf4bYjXZA6KVnegM7ECdy7A3f35ntfHeY
y9zI=?ct=applicationjavascript' | |
15 }, | |
16 { | |
17 'src': 'resources/setResultWithMIME.php?mime=application/jav
ascript&value=true', | |
18 'integrity': 'sha256-_CPhHgLf4bYjXZA6KVnegM7ECdy7A3f35ntfHeY
y9zI=?ct=app/javascript' | |
19 } | |
20 ]; | |
21 function scriptLoad() { | |
22 test.step(function() { | |
23 assert_unreached(); | |
24 }); | |
25 } | |
26 function scriptError() { | |
27 test.step(function() { | |
28 assert_false(result); | |
29 nextTest(); | |
30 }); | |
31 } | |
32 function nextTest() { | |
33 var next = tests.shift(); | |
34 if (!next) { | |
35 test.done(); | |
36 return; | |
37 } | |
38 result = false; | |
39 var script = document.createElement('script'); | |
40 script.onload = scriptLoad; | |
41 script.onerror = scriptError; | |
42 script.src = next.src; | |
43 script.integrity = next.integrity; | |
44 document.body.appendChild(script); | |
45 } | |
46 window.onload = function() { | |
47 nextTest(); | |
48 }; | |
49 </script> | |
50 </body> | |
OLD | NEW |