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

Side by Side Diff: LayoutTests/http/tests/security/link-crossorigin-stylesheet-no-cors.html

Issue 399653002: Rework CORS <link rel=stylesheet> tests as js-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move up window.test_count assignment Created 6 years, 5 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 <p>Test that a linked stylesheet with a crossorigin attribute does not load a cr oss-origin resource that isn't CORS enabled.</p> 2 <html>
3 <pre></pre> 3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
4 <script>window.test_count = 8;</script> 5 <script>window.test_count = 8;</script>
5 <script src="resources/link-crossorigin-common.js"></script> 6 <script src="resources/link-crossorigin-common.js"></script>
7 </head>
8 <body>
9 <p>Test that a linked stylesheet with a crossorigin attribute does not load a cr oss-origin resource that isn't CORS enabled.</p>
6 <link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/secur ity/resources/green-background.css?1" onload="fail()" onerror="pass()"> 10 <link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/secur ity/resources/green-background.css?1" onload="fail()" onerror="pass()">
7 <link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080 /security/resources/green-background.css?2" onload="fail()" onerror="pass()"> 11 <link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080 /security/resources/green-background.css?2" onload="fail()" onerror="pass()">
8 <!-- Check that from-cache loads are also failing (and does not generate separat e loads.) --> 12 <!-- Check that from-cache loads are also failing (and does not generate separat e loads.) -->
9 <link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/secur ity/resources/green-background.css?1" onload="fail()" onerror="pass()"> 13 <link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/secur ity/resources/green-background.css?1" onload="fail()" onerror="pass()">
10 <link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080 /security/resources/green-background.css?2" onload="fail()" onerror="pass()"> 14 <link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080 /security/resources/green-background.css?2" onload="fail()" onerror="pass()">
11 <!-- These are same-origin and should load as the fetch wasn't out of origin --> 15 <!-- These are same-origin and should load as the fetch wasn't out of origin -->
12 <link crossorigin="anonymous" rel="stylesheet" href="resources/green-background. css?3" onload="pass()" onerror="fail()"> 16 <link crossorigin="anonymous" rel="stylesheet" href="resources/green-background. css?3" onload="pass()" onerror="fail()">
13 <link crossorigin="use-credentials" rel="stylesheet" href="resources/green-backg round.css?4" onload="pass()" onerror="fail()"> 17 <link crossorigin="use-credentials" rel="stylesheet" href="resources/green-backg round.css?4" onload="pass()" onerror="fail()">
14 <script> 18 <script>
15 // Test that dynamically inserted <link> elements are handled the same way. 19 function runTest()
16 var link = document.createElement("link"); 20 {
17 link.rel = "stylesheet"; 21 // Test that dynamically inserted <link> elements are handled the same way.
18 link.crossOrigin = "anonymous"; 22 var link = document.createElement("link");
19 link.onload = fail; 23 link.rel = "stylesheet";
20 link.onerror = pass; 24 link.crossOrigin = "anonymous";
21 link.href = "http://localhost:8080/security/resources/green-background.css?8"; 25 link.onload = fail;
22 document.body.appendChild(link); 26 link.onerror = pass;
27 link.href = "http://localhost:8080/security/resources/green-background.css?8 ";
28 document.body.appendChild(link);
23 29
24 link = document.createElement("link"); 30 link = document.createElement("link");
25 link.rel = "stylesheet"; 31 link.rel = "stylesheet";
26 link.crossOrigin = "use-credentials"; 32 link.crossOrigin = "use-credentials";
27 link.onload = fail; 33 link.onload = fail;
28 link.onerror = pass; 34 link.onerror = pass;
29 link.href = "http://localhost:8080/security/resources/green-background.css?9"; 35 link.href = "http://localhost:8080/security/resources/green-background.css?9 ";
30 document.body.appendChild(link); 36 document.body.appendChild(link);
37 }
38 window.onload = runTest;
31 </script> 39 </script>
40 </body>
41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698