Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/link-crossorigin-preload-anonymous.html

Issue 2903653005: [preload] Mandatory `as` value and related spec alignments (Closed)
Patch Set: IDL changes Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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=anonymous loads a CORS enabled resource."); 9 var t = async_test("Test that a preload with a crossorigin=anonymous loads a CORS enabled resource.");
10 var anonymousMarkupLoad = false; 10 var anonymousMarkupLoad = false;
11 var credentialsMarkupLoad = false; 11 var credentialsMarkupLoad = false;
12 var anonymousDynamicLoad = false; 12 var anonymousDynamicLoad = false;
13 var credentialsDynamicLoad = false; 13 var credentialsDynamicLoad = false;
14 </script> 14 </script>
15 <link crossorigin="anonymous" rel="preload" href="http://localhost:8080/security /resources/abe-allow-star.php" onload="anonymousMarkupLoad = true;"> 15 <link crossorigin="anonymous" rel="preload" as="fetch" href="http://localhost:80 80/security/resources/abe-allow-star.php" onload="anonymousMarkupLoad = true;">
16 <link crossorigin="anonymous" rel="preload" href="http://localhost:8080/security /resources/abe-allow-credentials.php" onload="credentialsMarkupLoad = true;"> 16 <link crossorigin="anonymous" rel="preload" as="fetch" href="http://localhost:80 80/security/resources/abe-allow-credentials.php" onload="credentialsMarkupLoad = true;">
17 <script> 17 <script>
18 // Test that dynamically inserted <link> elements are handled the same way. 18 // Test that dynamically inserted <link> elements are handled the same way.
19 var link = document.createElement("link"); 19 var link = document.createElement("link");
20 link.rel = "preload"; 20 link.rel = "preload";
21 link.as = "fetch";
21 link.crossOrigin = "anonymous"; 22 link.crossOrigin = "anonymous";
22 link.addEventListener("load", function() { anonymousDynamicLoad = true; }); 23 link.addEventListener("load", function() { anonymousDynamicLoad = true; });
23 link.href = "http://localhost:8080/security/resources/abe-allow-star.php?1"; 24 link.href = "http://localhost:8080/security/resources/abe-allow-star.php?1";
24 document.body.appendChild(link); 25 document.body.appendChild(link);
25 26
26 link = document.createElement("link"); 27 link = document.createElement("link");
27 link.rel = "preload"; 28 link.rel = "preload";
29 link.as = "fetch";
28 link.crossOrigin = "anonymous"; 30 link.crossOrigin = "anonymous";
29 link.addEventListener("load", function() { credentialsDynamicLoad = true; }) ; 31 link.addEventListener("load", function() { credentialsDynamicLoad = true; }) ;
30 link.href = "http://localhost:8080/security/resources/abe-allow-credentials. php?1"; 32 link.href = "http://localhost:8080/security/resources/abe-allow-credentials. php?1";
31 document.body.appendChild(link); 33 document.body.appendChild(link);
32 </script> 34 </script>
33 <script src="../resources/slow-script.pl?delay=500"></script> 35 <script src="../resources/slow-script.pl?delay=500"></script>
34 <script> 36 <script>
35 window.onload = t.step(function(){ 37 window.onload = t.step(function(){
36 assert_true(anonymousMarkupLoad, "anonymous markup resource triggered lo ad event"); 38 assert_true(anonymousMarkupLoad, "anonymous markup resource triggered lo ad event");
37 assert_true(credentialsMarkupLoad, "use-credentials markup resource trig gered load event"); 39 assert_true(credentialsMarkupLoad, "use-credentials markup resource trig gered load event");
38 assert_true(anonymousDynamicLoad, "anonymous dynamic resource triggered load event"); 40 assert_true(anonymousDynamicLoad, "anonymous dynamic resource triggered load event");
39 assert_true(credentialsDynamicLoad, "use-credentials dynamic resource tr iggered load event"); 41 assert_true(credentialsDynamicLoad, "use-credentials dynamic resource tr iggered load event");
40 t.done(); 42 t.done();
41 }); 43 });
42 </script> 44 </script>
43 </body> 45 </body>
44 </html> 46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698