<!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>
  promise_test(t => {
    return new Promise((resolve, reject) => {
      let key = "worker-same-origin";
      let w = new Worker("/fetch/sec-metadata/resources/record-header.py?file=" + key);
      w.onmessage = e => {
        let expected = {"destination":"worker", "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 worker");
</script>
<body></body>
