1<!DOCTYPE html> 2<meta charset=utf-8> 3<script src="/resources/testharness.js"></script> 4<script src="/resources/testharnessreport.js"></script> 5<script src="/common/get-host-info.sub.js"></script> 6<!-- Pull in the with_iframe helper function from the service worker tests --> 7<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> 8<body> 9<script> 10 11const events = []; 12 13function testCompletion(t) { 14 return new Promise((resolve) => { 15 window.addEventListener("message", t.step_func(e => { 16 if (e.data == 'done') { 17 assert_equals(events.length, 0); 18 resolve(); 19 } 20 })); 21 }); 22} 23 24promise_test(async t => { 25 26 const bc0 = new BroadcastChannel('no-cross-origin-messages'); 27 bc0.onmessage = e => {window.events.push(e);}; 28 29 const testResults = testCompletion(t); 30 const url = get_host_info().HTTPS_NOTSAMESITE_ORIGIN + 31 '/webmessaging/broadcastchannel/resources/cross-origin.html'; 32 await with_iframe(url); 33 34 return testResults; 35}, "Messages aren't delivered across origins"); 36 37</script> 38</body> 39