utatane.tea@gmail.com | 5a900ab | 2017-11-10 05:28:34 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Module integrity check is ignored if target module is already cached</title> |
| 5 | <script src="../../../resources/testharness.js"></script> |
| 6 | <script src="../../../resources/testharnessreport.js"></script> |
| 7 | </head> |
| 8 | <body> |
| 9 | <script> |
| 10 | promise_test(() => { |
| 11 | return new Promise(function (resolve, reject) { |
| 12 | var script = document.createElement('script'); |
| 13 | script.type = 'module'; |
| 14 | script.src = './script-tests/module-integrity-bad-value-success-with-cache.js'; |
| 15 | script.integrity = 'sha256-7iiaipciOq3/cXnCpuOPyoC9GgCQw2F6y84mH4CJrGk='; |
| 16 | script.onload = function () { |
| 17 | assert_equals(window.moduleIsLoaded, true); |
| 18 | var scriptWithBadValue = document.createElement('script'); |
| 19 | scriptWithBadValue.type = 'module'; |
| 20 | scriptWithBadValue.src = './script-tests/module-integrity-bad-value-success-with-cache.js'; |
| 21 | scriptWithBadValue.integrity = 'sha256-badbeef'; |
| 22 | scriptWithBadValue.onload = resolve; |
| 23 | scriptWithBadValue.onerror = reject; |
| 24 | document.body.appendChild(scriptWithBadValue); |
| 25 | }; |
| 26 | script.onerror = reject; |
| 27 | document.body.appendChild(script); |
| 28 | }); |
| 29 | }, 'Module integrity check is ignored if target module is already cached'); |
| 30 | </script> |
| 31 | </body> |
| 32 | </html> |