OLD | NEW |
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 Loading... |
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", |
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://127.0.0.1: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://127.0.0.1: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 |
(...skipping 14 matching lines...) Expand all Loading... |
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> |
OLD | NEW |