dom/broadcastchannel/tests/test_dataURL.html
author Serban Stanca <sstanca@mozilla.com>
Mon, 14 Jul 2025 00:37:50 +0300 (9 hours ago)
changeset 796395 57c30f1adca5fb5ccd4a9a09192c41e207e28d88
parent 560730 65394ac48dd4109dfa728d726646e9adda540fe5
permissions -rw-r--r--
Revert "Bug 1950748 part 3: Don't return a caret inside an editor when no editor is focused. r=morgan" as requested for causing accessibility crashes (bug 1977012). This reverts commit aaf970807d281c28c1e937491719d996cb11648a. This reverts commit f5f2e3cf4d34c2430372ba790d77620837d56b75. This reverts commit 5565c5899c32c0b0f5446561a21c5b6499fd44c6.
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for BroadcastChannel in data: URL</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="dataURL">
var a = new BroadcastChannel('a');
var b = new BroadcastChannel('a');
a.onmessage = function(e) { parent.postMessage(e.data, "*"); };
b.postMessage(42);
</div>

<script>

SimpleTest.waitForExplicitFinish();

onmessage = function(e) {
  is(e.data, 42, "BroadcastChannel works with data URLs");
  SimpleTest.finish();
};

// eslint-disable-next-line no-useless-concat
var url = "data:text/html,<script>" + document.getElementById("dataURL").textContent + "</" + "script>";

var ifr = document.createElement("iframe");
document.body.appendChild(ifr);

ifr.setAttribute("sandbox", "allow-scripts");
ifr.src = url;
</script>
</body>
</html>