mirror of
https://github.com/servo/servo
synced 2026-05-15 11:26:50 +02:00
83 lines
2.4 KiB
HTML
83 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script src=/fetch/metadata/resources/helper.js></script>
|
|
<body>
|
|
<script>
|
|
async_test(t => {
|
|
let i = document.createElement('iframe');
|
|
i.src = "http://{{host}}:{{ports[http][0]}}/fetch/metadata/resources/post-to-owner.py";
|
|
window.addEventListener('message', t.step_func(e => {
|
|
if (e.source != i.contentWindow)
|
|
return;
|
|
|
|
assert_header_equals(e.data, {
|
|
"site": "",
|
|
"user": "",
|
|
"mode": "",
|
|
"dest": ""
|
|
}, "Non-secure same-origin iframe => No headers");
|
|
t.done();
|
|
}));
|
|
|
|
document.body.appendChild(i);
|
|
}, "Non-secure same-origin iframe => No headers");
|
|
|
|
async_test(t => {
|
|
let i = document.createElement('iframe');
|
|
i.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/fetch/metadata/resources/post-to-owner.py";
|
|
window.addEventListener('message', t.step_func(e => {
|
|
if (e.source != i.contentWindow)
|
|
return;
|
|
|
|
assert_header_equals(e.data, {
|
|
"site": "",
|
|
"user": "",
|
|
"mode": "",
|
|
"dest": ""
|
|
}, "Non-secure same-site iframe => No headers");
|
|
t.done();
|
|
}));
|
|
|
|
document.body.appendChild(i);
|
|
}, "Non-secure same-site iframe => No headers");
|
|
|
|
async_test(t => {
|
|
let i = document.createElement('iframe');
|
|
i.src = "http://{{hosts[alt][www]}}:{{ports[http][0]}}/fetch/metadata/resources/post-to-owner.py";
|
|
window.addEventListener('message', t.step_func(e => {
|
|
if (e.source != i.contentWindow)
|
|
return;
|
|
|
|
assert_header_equals(e.data, {
|
|
"site": "",
|
|
"user": "",
|
|
"mode": "",
|
|
"dest": ""
|
|
}, "Non-secure cross-site iframe => No headers.");
|
|
t.done();
|
|
}));
|
|
|
|
document.body.appendChild(i);
|
|
}, "Non-secure cross-site iframe => No headers.");
|
|
|
|
async_test(t => {
|
|
let i = document.createElement('iframe');
|
|
i.src = "https://{{host}}:{{ports[https][0]}}/fetch/metadata/resources/post-to-owner.py";
|
|
window.addEventListener('message', t.step_func(e => {
|
|
if (e.source != i.contentWindow)
|
|
return;
|
|
|
|
assert_header_equals(e.data, {
|
|
"site": "cross-site",
|
|
"user": "",
|
|
"mode": "navigate",
|
|
"dest": "iframe"
|
|
}, "Secure, cross-site (cross-scheme, same-host) iframe");
|
|
t.done();
|
|
}));
|
|
|
|
document.body.appendChild(i);
|
|
}, "Secure, cross-site (cross-scheme, same-host) iframe");
|
|
</script>
|