OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 var t = async_test("Test that a preload with a crossorigin=use-credentials a
ttribute loads the expected CORS enabled resources."); | 9 var t = async_test("Test that a preload with a crossorigin=use-credentials a
ttribute loads the expected CORS enabled resources."); |
10 var credentialSpecificMarkupLoad = false; | 10 var credentialSpecificMarkupLoad = false; |
11 var credentialStarMarkupError = false; | 11 var credentialStarMarkupError = false; |
12 var credentialSpecificDynamicLoad = false; | 12 var credentialSpecificDynamicLoad = false; |
13 var credentialStarDynamicError = false; | 13 var credentialStarDynamicError = false; |
14 </script> | 14 </script> |
15 <link crossorigin="use-credentials" rel="preload" href="http://localhost:8080/se
curity/resources/abe-allow-credentials.php" onload="credentialSpecificMarkupLoad
= true;"> | 15 <link crossorigin="use-credentials" rel="preload" as="fetch" href="http://localh
ost:8080/security/resources/abe-allow-credentials.php" onload="credentialSpecifi
cMarkupLoad = true;"> |
16 <link crossorigin="use-credentials" rel="preload" href="http://localhost:8080/se
curity/resources/abe-allow-star.php" onerror="credentialStarMarkupError = true;"
> | 16 <link crossorigin="use-credentials" rel="preload" as="fetch" href="http://localh
ost:8080/security/resources/abe-allow-star.php" onerror="credentialStarMarkupErr
or = true;"> |
17 <script> | 17 <script> |
18 var link = document.createElement("link"); | 18 var link = document.createElement("link"); |
19 link.rel = "preload"; | 19 link.rel = "preload"; |
| 20 link.as = "fetch"; |
20 link.crossOrigin = "anonymous"; | 21 link.crossOrigin = "anonymous"; |
21 link.addEventListener("load", function() { credentialSpecificDynamicLoad = t
rue; }); | 22 link.addEventListener("load", function() { credentialSpecificDynamicLoad = t
rue; }); |
22 link.href = "http://localhost:8080/security/resources/abe-allow-credentials.
php?1"; | 23 link.href = "http://localhost:8080/security/resources/abe-allow-credentials.
php?1"; |
23 document.body.appendChild(link); | 24 document.body.appendChild(link); |
24 | 25 |
25 link = document.createElement("link"); | 26 link = document.createElement("link"); |
26 link.rel = "preload"; | 27 link.rel = "preload"; |
| 28 link.as = "fetch"; |
27 link.crossOrigin = "use-credentials"; | 29 link.crossOrigin = "use-credentials"; |
28 link.addEventListener("error", function() { credentialStarDynamicError = tru
e; }); | 30 link.addEventListener("error", function() { credentialStarDynamicError = tru
e; }); |
29 link.href = "http://localhost:8080/security/resources/abe-allow-star.php?1"; | 31 link.href = "http://localhost:8080/security/resources/abe-allow-star.php?1"; |
30 document.body.appendChild(link); | 32 document.body.appendChild(link); |
31 </script> | 33 </script> |
32 <script src="../resources/slow-script.pl?delay=500"></script> | 34 <script src="../resources/slow-script.pl?delay=500"></script> |
33 <script> | 35 <script> |
34 window.onload = t.step(function(){ | 36 window.onload = t.step(function(){ |
35 assert_true(credentialSpecificMarkupLoad, "credential specific markup re
source triggered load event"); | 37 assert_true(credentialSpecificMarkupLoad, "credential specific markup re
source triggered load event"); |
36 assert_true(credentialStarMarkupError, "credential star markup resource
triggered error event"); | 38 assert_true(credentialStarMarkupError, "credential star markup resource
triggered error event"); |
37 assert_true(credentialSpecificDynamicLoad, "credential specific dynamic
resource triggered load event"); | 39 assert_true(credentialSpecificDynamicLoad, "credential specific dynamic
resource triggered load event"); |
38 assert_true(credentialStarDynamicError, "credential star dynamic resourc
e triggered error event"); | 40 assert_true(credentialStarDynamicError, "credential star dynamic resourc
e triggered error event"); |
39 t.done(); | 41 t.done(); |
40 }); | 42 }); |
41 </script> | 43 </script> |
42 </body> | 44 </body> |
43 </html> | 45 </html> |
OLD | NEW |