blob: 8d89cda8936cc33a22e0899a2c8b3560b7ef20bd [file] [log] [blame]
<!DOCTYPE html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/fetch/sec-metadata/resources/helper.js></script>
<body>
<script>
async_test(t => {
let i = document.createElement('iframe');
i.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py";
window.addEventListener('message', t.step_func(e => {
if (e.source != i.contentWindow)
return;
assert_header_equals(e.data, {
"cause": "forced",
"destination": "nested-document",
"site": "same-origin"
});
t.done();
}));
document.body.appendChild(i);
}, "Same-origin iframe");
async_test(t => {
let i = document.createElement('iframe');
i.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py";
window.addEventListener('message', t.step_func(e => {
if (e.source != i.contentWindow)
return;
assert_header_equals(e.data, {
"cause": "forced",
"destination": "nested-document",
"site": "same-site"
});
t.done();
}));
document.body.appendChild(i);
}, "Same-site iframe");
async_test(t => {
let i = document.createElement('iframe');
i.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py";
window.addEventListener('message', t.step_func(e => {
if (e.source != i.contentWindow)
return;
assert_header_equals(e.data, {
"cause": "forced",
"destination": "nested-document",
"site": "cross-site"
});
t.done();
}));
document.body.appendChild(i);
}, "Cross-site iframe");
</script>