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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/link-crossorigin-preload-no-cors.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 attribute does no t load a cross-origin resource that isn't CORS enabled."); 9 var t = async_test("Test that a preload with a crossorigin attribute does no t load a cross-origin resource that isn't CORS enabled.");
10 var anonymousMarkupError = false; 10 var anonymousMarkupError = false;
11 var credentialsMarkupError = false; 11 var credentialsMarkupError = false;
12 var anonymousDynamicError = false; 12 var anonymousDynamicError = false;
13 var credentialsDynamicError = false; 13 var credentialsDynamicError = false;
14 </script> 14 </script>
15 <link crossorigin="anonymous" rel="preload" href="http://localhost:8000/security /resources/abe.png?1" onerror="anonymousMarkupError = true;"> 15 <link crossorigin="anonymous" rel="preload" as="fetch" href="http://localhost:80 00/security/resources/abe.png?1" onerror="anonymousMarkupError = true;">
16 <link crossorigin="use-credentials" rel="preload" href="http://localhost:8000/se curity/resources/abe.png?2" onerror="credentialsMarkupError = true;"> 16 <link crossorigin="use-credentials" rel="preload" as="fetch" href="http://localh ost:8000/security/resources/abe.png?2" onerror="credentialsMarkupError = 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.crossOrigin = "anonymous"; 20 link.crossOrigin = "anonymous";
21 link.rel = "preload"; 21 link.rel = "preload";
22 link.as = "fetch";
22 link.addEventListener("error", function() { anonymousDynamicError = true; }) ; 23 link.addEventListener("error", function() { anonymousDynamicError = true; }) ;
23 link.href = "http://localhost:8000/security/resources/abe.png?3"; 24 link.href = "http://localhost:8000/security/resources/abe.png?3";
24 document.body.appendChild(link); 25 document.body.appendChild(link);
25 26
26 link = document.createElement("link"); 27 link = document.createElement("link");
27 link.crossOrigin = "use-credentials"; 28 link.crossOrigin = "use-credentials";
28 link.rel = "preload"; 29 link.rel = "preload";
30 link.as = "fetch";
29 link.addEventListener("error", function() { credentialsDynamicError = true; }); 31 link.addEventListener("error", function() { credentialsDynamicError = true; });
30 link.href = "http://localhost:8000/security/resources/abe.png?4"; 32 link.href = "http://localhost:8000/security/resources/abe.png?4";
31 document.body.appendChild(link); 33 document.body.appendChild(link);
32 34
33 </script> 35 </script>
34 <script src="../resources/slow-script.pl?delay=500"></script> 36 <script src="../resources/slow-script.pl?delay=500"></script>
35 <script> 37 <script>
36 window.onload = t.step(function(){ 38 window.onload = t.step(function(){
37 assert_true(anonymousMarkupError, "anonymous markup resource triggered e rror event"); 39 assert_true(anonymousMarkupError, "anonymous markup resource triggered e rror event");
38 assert_true(credentialsMarkupError, "use-credentials markup resource tri ggered error event"); 40 assert_true(credentialsMarkupError, "use-credentials markup resource tri ggered error event");
39 assert_true(anonymousDynamicError, "anonymous dynamic resource triggered error event"); 41 assert_true(anonymousDynamicError, "anonymous dynamic resource triggered error event");
40 assert_true(credentialsDynamicError, "use-credentials dynamic resource t riggered error event"); 42 assert_true(credentialsDynamicError, "use-credentials dynamic resource t riggered error event");
41 t.done(); 43 t.done();
42 }); 44 });
43 </script> 45 </script>
44 </body> 46 </body>
45 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698