blob: 42e2626495ab40ca920204724e66526e66b93f85 [file] [log] [blame]
Kunihiko Sakamoto1a4049a2017-09-27 09:54:311<!DOCTYPE html>
Rob Buis7f72c4e2019-05-15 09:54:192<title>Makes sure that Link headers preload resources with CSP nonce</title>
Kunihiko Sakamoto1a4049a2017-09-27 09:54:313<script nonce="abc" src="/resources/testharness.js"></script>
4<script nonce="abc" src="/resources/testharnessreport.js"></script>
5<script nonce="abc" src="/preload/resources/preload_helper.js"></script>
Rob Buis7f72c4e2019-05-15 09:54:196<body>
Kunihiko Sakamoto1a4049a2017-09-27 09:54:317<script nonce="abc">
Rob Buis7f72c4e2019-05-15 09:54:198setup({explicit_done: true});
9
10var iterations = 0;
11
12function check_finished() {
13 if (numberOfResourceTimingEntries("resources/dummy.js?from-header&without-nonce") == 0 &&
14 numberOfResourceTimingEntries("resources/dummy.js?from-header&with-nonce") == 1) {
15 done();
16 }
17 iterations++;
18 if (iterations == 10) {
19 // At least one is expected to fail, but this should give details to the exact failure(s).
20 verifyNumberOfResourceTimingEntries("resources/dummy.js?from-header&without-nonce", 0);
21 verifyNumberOfResourceTimingEntries("resources/dummy.js?from-header&with-nonce", 1);
22 done();
23 } else {
24 step_timeout(check_finished, 500);
25 }
26}
27
28window.addEventListener("load", function() {
29 verifyPreloadAndRTSupport();
30 step_timeout(check_finished, 0);
31});
Kunihiko Sakamoto1a4049a2017-09-27 09:54:3132</script>
Rob Buis7f72c4e2019-05-15 09:54:1933</body>