blob: 6a5b7dc82653d65be570ce8728f2433a540a2af3 [file] [log] [blame]
utatane.tea@gmail.com5a900ab2017-11-10 05:28:34 +00001<!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>
10promise_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>