| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head></head> | 2 <head></head> |
| 3 <body> | 3 <body> |
| 4 | 4 |
| 5 <script src="/js-test-resources/js-test.js"></script> | 5 <script src="/js-test-resources/js-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 description('Test XMLHttpRequest.responseURL'); | 7 description('Test XMLHttpRequest.responseURL'); |
| 8 window.jsTestIsAsync = true; | 8 window.jsTestIsAsync = true; |
| 9 | 9 |
| 10 function get(url, type) { | 10 function get(url, type) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 if (xhr.readyState === 4) { | 23 if (xhr.readyState === 4) { |
| 24 resolve(xhr); | 24 resolve(xhr); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 xhr.send(); | 27 xhr.send(); |
| 28 }); | 28 }); |
| 29 } | 29 } |
| 30 | 30 |
| 31 get('resources/reply2.txt', 'text').then(function(xhr) { | 31 get('resources/reply2.txt', 'text').then(function(xhr) { |
| 32 window.status = xhr.status; | 32 window.status = xhr.status; |
| 33 shouldBeEqualToString('status', '2000'); | 33 shouldBeEqualToString('status', '200'); |
| 34 window.responseURL = xhr.responseURL; | 34 window.responseURL = xhr.responseURL; |
| 35 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/reply2.txt'); | 35 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/reply2.txt'); |
| 36 | 36 |
| 37 return get('resources/redirect.php?url=reply2.xml', 'document'); | 37 return get('resources/redirect.php?url=reply2.xml', 'document'); |
| 38 }).then(function(xhr) { | 38 }).then(function(xhr) { |
| 39 window.status = xhr.status; | 39 window.status = xhr.status; |
| 40 shouldBeEqualToString('status', '200'); | 40 shouldBeEqualToString('status', '200'); |
| 41 window.responseURL = xhr.responseURL; | 41 window.responseURL = xhr.responseURL; |
| 42 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/reply2.xml'); | 42 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/reply2.xml'); |
| 43 | 43 |
| 44 return get('resources/navigation-target.html#foobar', 'text'); |
| 45 }).then(function(xhr) { |
| 46 window.status = xhr.status; |
| 47 shouldBeEqualToString('status', '200'); |
| 48 window.responseURL = xhr.responseURL; |
| 49 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/navigation-target.html'); |
| 50 |
| 44 return get('resources/redirect.php?url=not-found.txt', 'text'); | 51 return get('resources/redirect.php?url=not-found.txt', 'text'); |
| 45 }).then(function(xhr) { | 52 }).then(function(xhr) { |
| 46 window.status = xhr.status; | 53 window.status = xhr.status; |
| 47 shouldBeEqualToString('status', '404'); | 54 shouldBeEqualToString('status', '404'); |
| 48 window.responseURL = xhr.responseURL; | 55 window.responseURL = xhr.responseURL; |
| 49 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/not-found.txt'); | 56 shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/r
esources/not-found.txt'); |
| 50 | 57 |
| 51 xhr.open('GET', xhr.responseURL); | 58 xhr.open('GET', xhr.responseURL); |
| 52 }).catch(function(reason) { | 59 }).catch(function(reason) { |
| 53 testFailed(String(reason)); | 60 testFailed(String(reason)); |
| 54 }).then(finishJSTest, finishJSTest); | 61 }).then(finishJSTest, finishJSTest); |
| 55 | 62 |
| 56 </script> | 63 </script> |
| 57 </body> | 64 </body> |
| 58 </html> | 65 </html> |
| OLD | NEW |