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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-and-redirects-async.html

Issue 2421093003: Allow redirects for requests that require preflight. (Closed)
Patch Set: Fix failing test Created 4 years, 1 month 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 <p>Tests that asynchronous XMLHttpRequests handle redirects according to the COR S standard.</p> 1 <p>Tests that asynchronous XMLHttpRequests handle redirects according to the COR S standard.</p>
2 2
3 <pre id="console"></pre> 3 <pre id="console"></pre>
4 <script> 4 <script>
5 if (window.testRunner) { 5 if (window.testRunner) {
6 testRunner.dumpAsText(); 6 testRunner.dumpAsText();
7 testRunner.waitUntilDone(); 7 testRunner.waitUntilDone();
8 } 8 }
9 9
10 function log(message) 10 function log(message)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 var tests = [ 43 var tests = [
44 // 1) Test simple cross origin requests that receive redirects. 44 // 1) Test simple cross origin requests that receive redirects.
45 45
46 // Receives a redirect response without CORS headers. The redirect response fail s the access check. 46 // Receives a redirect response without CORS headers. The redirect response fail s the access check.
47 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=http://lo calhost:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi", 47 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=http://lo calhost:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi",
48 withoutCredentials, noCustomHeader, fails], 48 withoutCredentials, noCustomHeader, fails],
49 49
50 // Receives a redirect response with CORS headers. The redirect response passes the access check and the resource response 50 // Receives a redirect response with CORS headers. The redirect response passes the access check and the resource response
51 // passes the access check. 51 // passes the access check.
52 // FIXME: this test fails because the redirect is vetoed. There are continued bu gs with redirects when the original
53 // request was cross-origin.
54 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=http://lo calhost:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi&\ 52 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=http://lo calhost:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi&\
55 access-control-allow-origin=http://localhost:8000", 53 access-control-allow-origin=http://127.0.0.1:8000",
yhirano 2016/11/16 08:20:28 Hm, the document origin is http://127.0.0.1:8000 a
Jack Bates 2016/11/20 18:51:11 Done.
56 withoutCredentials, noCustomHeader, succeeds], 54 withoutCredentials, noCustomHeader, succeeds],
57 55
58 // Receives a redirect response with a URL containing the userinfo production. 56 // Receives a redirect response with a URL containing the userinfo production.
59 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=http://us ername:password@localhost:8000/xmlhttprequest/resources/access-control-basic-all ow-star.cgi&\ 57 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=http://us ername:password@localhost:8000/xmlhttprequest/resources/access-control-basic-all ow-star.cgi&\
60 access-control-allow-origin=http://localhost:8000", 58 access-control-allow-origin=http://localhost:8000",
61 withoutCredentials, noCustomHeader, fails], 59 withoutCredentials, noCustomHeader, fails],
62 60
63 // Receives a redirect response with a URL with an unsupported scheme. 61 // Receives a redirect response with a URL with an unsupported scheme.
64 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=foo://bar .cgi&\ 62 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?url=foo://bar .cgi&\
65 access-control-allow-origin=http://localhost:8000", 63 access-control-allow-origin=http://localhost:8000",
66 withoutCredentials, noCustomHeader, fails], 64 withoutCredentials, noCustomHeader, fails],
67 65
68 // 2) Test preflighted cross origin requests that receive redirects. 66 // 2) Test preflighted cross origin requests that receive redirects.
69 67
70 // Receives a redirect response to the preflight request and fails. 68 // Receives a redirect response to the preflight request and fails.
71 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?redirect-pref light=true&\ 69 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?redirect-pref light=true&\
72 url=http://localhost:8000/xmlhttprequest/resources/access-control-basic-allow- star.cgi&\ 70 url=http://localhost:8000/xmlhttprequest/resources/access-control-basic-allow- star.cgi&\
73 access-control-allow-origin=*", 71 access-control-allow-origin=*",
74 withoutCredentials, addCustomHeader, fails], 72 withoutCredentials, addCustomHeader, fails],
75 73
76 // Successful preflight and receives a redirect response to the actual request a nd fails. 74 // Successful preflight and receives a redirect response to the actual request a nd fails.
77 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?redirect-pref light=false&\ 75 ["http://localhost:8000/xmlhttprequest/resources/redirect-cors.php?redirect-pref light=false&\
78 url=http://localhost:8000/xmlhttprequest/resources/access-control-basic-allow- star.cgi&\ 76 url=http://localhost:8000/xmlhttprequest/resources/access-control-basic-allow- star.cgi&\
79 access-control-allow-origin=*&\ 77 access-control-allow-origin=*&\
80 access-control-allow-headers=x-webkit", 78 access-control-allow-headers=x-webkit",
81 withoutCredentials, addCustomHeader, fails], 79 withoutCredentials, addCustomHeader, succeeds],
82 80
83 // 3) Test same origin requests with a custom header that receive a same origin redirect. 81 // 3) Test same origin requests with a custom header that receive a same origin redirect.
84 ["resources/redirect-cors.php?url=http://127.0.0.1:8000/xmlhttprequest/resources /get.txt", 82 ["resources/redirect-cors.php?url=http://127.0.0.1:8000/xmlhttprequest/resources /get.txt",
85 withoutCredentials, addCustomHeader, succeeds], 83 withoutCredentials, addCustomHeader, succeeds],
86 84
87 ] 85 ]
88 86
89 var currentTest = 0; 87 var currentTest = 0;
90 88
91 function nextTest() { 89 function nextTest() {
92 if (currentTest < tests.length) 90 if (currentTest < tests.length)
93 runTestAsync.apply(null, tests[currentTest++]); 91 runTestAsync.apply(null, tests[currentTest++]);
94 else if (window.testRunner) 92 else if (window.testRunner)
95 testRunner.notifyDone(); 93 testRunner.notifyDone();
96 } 94 }
97 95
98 nextTest(); 96 nextTest();
99 </script> 97 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698