Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>XMLHttpRequest: open() resolving URLs - insert <base> after open()</title> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| 7 | <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol/li[2]/ol/li[2] following::ol/li[7] following::ol/li[14]/ul/li[2]" /> |
| 8 | <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[4]" /> |
| 9 | </head> |
| 10 | <body> |
| 11 | <div id="log"></div> |
| 12 | <script> |
| 13 | test(function() { |
| 14 | var client = new XMLHttpRequest(), |
| 15 | base = document.createElement("base") |
| 16 | base.href = location.href.replace(/\/[^/]*$/, '') + "/resources/" |
| 17 | client.open("GET", "folder.txt", false) |
| 18 | document.getElementsByTagName("head")[0].appendChild(base) |
| 19 | client.send(null) |
| 20 | assert_equals(client.responseText, "top\n") |
| 21 | }) |
| 22 | </script> |
| 23 | </body> |
| 24 | </html> |