blob: 09017ccbb3a2b1b878d15e4199d59cad29a2277a [file] [log] [blame]
<!DOCTYPE html>
<link rel="author" href="mtrzos@google.com" title="Maciek Trzos">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/fetch/sec-metadata/resources/helper.js></script>
<script>
// TESTS //
if (window.Worker) {
// Same-Origin test
var sharedWorker = new SharedWorker('/fetch/sec-metadata/resources/record-header.py?file=sharedworker-same-origin');
sharedWorker.port.start();
sharedWorker.onerror = function(){
test_same_origin();
}
sharedWorker.port.onmessage = function(e) {
test_same_origin();
}
sharedWorker.port.postMessage("Ready");
}
function test_same_origin(){
promise_test(t => {
return new Promise((resolve, reject) => {
let key = "sharedworker-same-origin";
let expected = {"destination":"sharedworker", "site":"same-origin"};
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
.then(response => response.text())
.then(text => assert_header_equals(text, expected))
.then(_ => resolve())
.catch(e => reject(e));
})
}, "Same-Origin sharedworker")
}
</script>
<body></body>