<!doctype html>
<body>
  <script src=/resources/testharness.js></script>
  <script src=/resources/testharnessreport.js></script>
  <script>
    promise_test(async t => {
      try {
        let response = await fetch('./resources/check-topics-request-header.py', {browsingTopics: true});
      } catch (e) {
        assert_equals(e.name, 'TypeError');
        assert_equals(e.message, 'Failed to execute \'fetch\' on \'Window\': browsingTopics: Topics operations are only available in secure contexts.');
        return;
      }
      assert_unreached("did not reject");
    }, 'test fetch(<url>, {browsingTopics: true}) in insecure context');
  </script>
</body>
