OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Subresource Integrity</title> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 <div id="log"></div> |
| 7 |
| 8 <script> |
| 9 var loads_scripts_with_badly_encoded_digest; |
| 10 var loads_scripts_with_correct_content_type; |
| 11 var loads_scripts_with_improper_integrity_uri_scheme; |
| 12 var loads_scripts_with_incorrect_content_type; |
| 13 var loads_scripts_with_matching_digest; |
| 14 var loads_scripts_with_non_matching_digest; |
| 15 var loads_scripts_with_weak_digest_algorithms; |
| 16 </script> |
| 17 |
| 18 <!-- Shouldn't load. Correct URI is ni:///sha-256;ME12ZWwv8POIkFVSgWFgW3sbnHh0D
B-Fyb57zYQAFhs --> |
| 19 <script src="loads-scripts-with-badly-encoded-digest.js" integrity="ni:///sha-25
6;ME12ZWwv8POIkFVSgWFgW3sbnHh0DB+Fyb57zYQAFhs"></script> |
| 20 |
| 21 <!-- Should load --> |
| 22 <script src="loads-scripts-with-correct-content-type.js" integrity="ni:///sha-25
6;ZrrvOG-Kjz4R-FDFrfSQCQC_oMDfc0kQ3DJNd5URlrY?ct=application/javascript"></scrip
t> |
| 23 |
| 24 <!-- Shouldn't load. Correct URI is ni:///sha-256;J9PNsSFLX168LnQhGZeryaLZDmTLy
_fMdx4pO-LhjW4 --> |
| 25 <script src="loads-scripts-with-improper-integrity-uri-scheme.js" integrity="wro
ng:///sha-256;J9PNsSFLX168LnQhGZeryaLZDmTLy_fMdx4pO-LhjW4"></script> |
| 26 |
| 27 <!-- Shouldn't load. Correct URI is ni:///sha-256;LiWoBTgUHmhVG6gn0dO9R0lBEItHg
ny2pnvLtBOc0tI?ct=application/javascript --> |
| 28 <script src="loads-scripts-with-incorrect-content-type.js" integrity="ni:///sha-
256;LiWoBTgUHmhVG6gn0dO9R0lBEItHgny2pnvLtBOc0tI?ct=text/plain"></script> |
| 29 |
| 30 <!-- Should load --> |
| 31 <script src="loads-scripts-with-matching-digest.js" integrity="ni:///sha-256;EKc
lUXH9SRRUv3FmL7bIEV0z2s3EvzHFxzHKCnfHT_E"></script> |
| 32 |
| 33 <!-- Shouldn't load. Correct URI is ni:///sha-256;mmx3g0H5KnIi_lnkuMJzYK7q6ss-W
np-7zoGvgiQVtU --> |
| 34 <script src="loads-scripts-with-non-matching-digest.js" integrity="ni:///sha-256
;EKclUXH9SRRUv3FmL7bIEV0z2s3EvzHFxzHKCnfHT_E"></script> |
| 35 |
| 36 <!-- Shouldn't load. MD5 is considered to be a weak algorithm --> |
| 37 <script src="loads-scripts-with-weak-digest-algorithms.js" integrity="ni:///md5;
XHzXKrCo5jhDN4BvNhs-4A"></script> |
| 38 |
| 39 <script> |
| 40 function assert_undefined(actual) { |
| 41 assert_equals(actual, undefined, "Should be undefined."); |
| 42 } |
| 43 |
| 44 test(function() { |
| 45 assert_undefined(loads_scripts_with_badly_encoded_digest) |
| 46 }, "Doesn't load scripts with badly encoded digests"); |
| 47 |
| 48 test(function() { |
| 49 assert_true(loads_scripts_with_correct_content_type) |
| 50 }, "Loads scripts with correct content type"); |
| 51 |
| 52 test(function() { |
| 53 assert_undefined(loads_scripts_with_improper_integrity_uri_scheme) |
| 54 }, "Doesn't load scripts with improper integrity URI scheme"); |
| 55 |
| 56 test(function() { |
| 57 assert_undefined(loads_scripts_with_incorrect_content_type) |
| 58 }, "Doesn't load scripts with incorrect content-type"); |
| 59 |
| 60 test(function() { |
| 61 assert_true(loads_scripts_with_matching_digest) |
| 62 }, "Loads scripts with matching digest"); |
| 63 |
| 64 test(function() { |
| 65 assert_undefined(loads_scripts_with_non_matching_digest) |
| 66 }, "Doesn't load scripts with non-matching digest"); |
| 67 |
| 68 test(function() { |
| 69 assert_undefined(loads_scripts_with_weak_digest_algorithms) |
| 70 }, "Doesn't load scripts using weak digest algorithm"); |
| 71 </script> |
OLD | NEW |