gecko-dev/dom/broadcastchannel/tests/testUrl2_bfcache.html
Olli Pettay fae44f08b8 Bug 1692639 - Change dom/broadcastchannel/tests/test_bfcache.html to use BroadcastChannel, r=annyG
This changes the test a bit. It doesn't test BroadcastChannel's postMessage anymore, but receiving the message.
I can't see how postMessage could be tested, since given the new setup, no one should have access to it anymore.

This is functionally now very similar to another test I wrote recently, but I think it is fine to keep this too.

Differential Revision: https://phabricator.services.mozilla.com/D109539
2021-04-08 21:15:02 +00:00

13 lines
282 B
HTML

<script>
onpageshow = function(e) {
var bc2 = new BroadcastChannel("testUrl2_bfcache");
bc2.onmessage = function(event) {
if (event.data == "back") {
bc2.close();
history.back();
}
};
bc2.postMessage({type: e.type, persisted: e.persisted});
};
</script>