Teach XHR how to handle relative urls.

Hixie says window.URL may not exist yet in the
sky specs, but I'm sure we'll need something like it.

R=ojan@chromium.org, abarth@chromium.org

Review URL: https://codereview.chromium.org/729913003
This commit is contained in:
Eric Seidel
2014-11-18 11:15:56 -08:00
parent c120bdf84f
commit bae7972281
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
Running 1 tests
ok 1 XMLHttpRequest should be able to fetch relative urls
1 tests
1 pass
0 fail

View File

@@ -0,0 +1,22 @@
<html>
<import src="../resources/chai.sky" />
<import src="../resources/mocha.sky" />
<import src="/sky/framework/xmlhttprequest.sky" as="XMLHttpRequest" />
<script>
describe('XMLHttpRequest', function() {
this.enableTimeouts(false);
it('should be able to fetch relative urls', function(done) {
var xhr = new XMLHttpRequest();
xhr.onload = function() {
// Also testing that "this" is set correctly in the onload callback.
assert.equal(this.responseText, "This is data from the network.\n");
done();
};
xhr.open("GET", "resources/pass.txt");
xhr.send();
});
});
</script>
</html>