mirror of
https://github.com/servo/servo.git
synced 2025-07-11 17:33:47 +01:00
85 lines
2.5 KiB
HTML
85 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script src=/fetch/sec-metadata/resources/helper.js></script>
|
|
<script>
|
|
// Site
|
|
promise_test(t => {
|
|
return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py")
|
|
.then(r => r.json())
|
|
.then(j => {
|
|
assert_header_equals(j, {
|
|
"dest": "empty",
|
|
"site": "same-origin",
|
|
"user": "",
|
|
"mode": "cors",
|
|
});
|
|
});
|
|
}, "Same-origin fetch");
|
|
|
|
promise_test(t => {
|
|
return fetch("https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py")
|
|
.then(r => r.json())
|
|
.then(j => {
|
|
assert_header_equals(j, {
|
|
"dest": "empty",
|
|
"site": "same-site",
|
|
"user": "",
|
|
"mode": "cors",
|
|
});
|
|
});
|
|
}, "Same-site fetch");
|
|
|
|
promise_test(t => {
|
|
return fetch("https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py")
|
|
.then(r => r.json())
|
|
.then(j => {
|
|
assert_header_equals(j, {
|
|
"dest": "empty",
|
|
"site": "cross-site",
|
|
"user": "",
|
|
"mode": "cors",
|
|
});
|
|
});
|
|
}, "Cross-site fetch");
|
|
|
|
// Mode
|
|
promise_test(t => {
|
|
return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py", {mode: "same-origin"})
|
|
.then(r => r.json())
|
|
.then(j => {
|
|
assert_header_equals(j, {
|
|
"dest": "empty",
|
|
"site": "same-origin",
|
|
"user": "",
|
|
"mode": "same-origin",
|
|
});
|
|
});
|
|
}, "Same-origin mode");
|
|
|
|
promise_test(t => {
|
|
return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py", {mode: "cors"})
|
|
.then(r => r.json())
|
|
.then(j => {
|
|
assert_header_equals(j, {
|
|
"dest": "empty",
|
|
"site": "same-origin",
|
|
"user": "",
|
|
"mode": "cors",
|
|
});
|
|
});
|
|
}, "CORS mode");
|
|
|
|
promise_test(t => {
|
|
return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py", {mode: "no-cors"})
|
|
.then(r => r.json())
|
|
.then(j => {
|
|
assert_header_equals(j, {
|
|
"dest": "empty",
|
|
"site": "same-origin",
|
|
"user": "",
|
|
"mode": "no-cors",
|
|
});
|
|
});
|
|
}, "no-CORS mode");
|
|
</script>
|