11cb0ef41Sopenharmony_ci<!DOCTYPE html>
21cb0ef41Sopenharmony_ci<meta charset=utf-8>
31cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script>
41cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script>
51cb0ef41Sopenharmony_ci<script src="/common/get-host-info.sub.js"></script>
61cb0ef41Sopenharmony_ci<!-- Pull in the with_iframe helper function from the service worker tests -->
71cb0ef41Sopenharmony_ci<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
81cb0ef41Sopenharmony_ci<body>
91cb0ef41Sopenharmony_ci<script>
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst events = [];
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_cifunction testCompletion(t) {
141cb0ef41Sopenharmony_ci  return new Promise((resolve) => {
151cb0ef41Sopenharmony_ci    window.addEventListener("message", t.step_func(e => {
161cb0ef41Sopenharmony_ci      if (e.data == 'done') {
171cb0ef41Sopenharmony_ci        assert_equals(events.length, 0);
181cb0ef41Sopenharmony_ci        resolve();
191cb0ef41Sopenharmony_ci      }
201cb0ef41Sopenharmony_ci    }));
211cb0ef41Sopenharmony_ci  });
221cb0ef41Sopenharmony_ci}
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_cipromise_test(async t => {
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci  const bc0 = new BroadcastChannel('no-cross-origin-messages');
271cb0ef41Sopenharmony_ci  bc0.onmessage = e => {window.events.push(e);};
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci  const testResults = testCompletion(t);
301cb0ef41Sopenharmony_ci  const url = get_host_info().HTTPS_NOTSAMESITE_ORIGIN +
311cb0ef41Sopenharmony_ci    '/webmessaging/broadcastchannel/resources/cross-origin.html';
321cb0ef41Sopenharmony_ci  await with_iframe(url);
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci  return testResults;
351cb0ef41Sopenharmony_ci}, "Messages aren't delivered across origins");
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci</script>
381cb0ef41Sopenharmony_ci</body>
39