message", () => handler(self.postMessage));
// For shared workers:
self.addEventListener("connect", (e) => {
  var port = e.ports[0];
  handler(msg => port.postMessage(msg));
});
`;
  return "data:,".concat(encodeURIComponent(source));
}

promise_test(t => {
  return new Promise((resolve, reject) => {
    const channel_name = "opaque-origin-test-3";
    const bc1 = new BroadcastChannel(channel_name);
    bc1.onmessage = e => { reject("Received message from an opaque origin"); };

    // Same as the previous