mirror of
https://github.com/servo/servo
synced 2026-05-01 20:07:22 +02:00
Update web-platform-tests to revision 7f2f85a88f434798e9d643427b34b05fab8278c6
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
if (this.document === undefined) {
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("../resources/utils.js");
|
||||
}
|
||||
|
||||
function fetchSameOrigin(url, shouldPass) {
|
||||
promise_test(function(test) {
|
||||
if (shouldPass)
|
||||
return fetch(url , {"mode": "same-origin"}).then(function(resp) {
|
||||
assert_equals(resp.status, 200, "HTTP status is 200");
|
||||
assert_equals(resp.type, "basic", "response type is basic");
|
||||
});
|
||||
else
|
||||
return promise_rejects(test, new TypeError, fetch(url, {mode: "same-origin"}));
|
||||
}, "Fetch "+ url + " with same-origin mode");
|
||||
}
|
||||
|
||||
fetchSameOrigin(RESOURCES_DIR + "top.txt", true);
|
||||
fetchSameOrigin("http://{{host}}:{{ports[http][0]}}/fetch/api/resources/top.txt", true);
|
||||
fetchSameOrigin("https://{{host}}:{{ports[https][0]}}/fetch/api/resources/top.txt", false);
|
||||
fetchSameOrigin("http://{{domains[www]}}:{{ports[http][0]}}/fetch/api/resources/top.txt", false);
|
||||
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user