summaryrefslogtreecommitdiffstats
path: root/docshell/test/mochitest/file_bug1121701_2.html
blob: 6cec88cd5dd6445c24a9d3a6e4c80603c56e8090 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script>
  var bc = new BroadcastChannel("file_bug1121701_2");
  bc.onmessage = (msgEvent) => {
    var msg = msgEvent.data;
    var command = msg.command;
    if (command == "setInnerHTML") {
      window.document.body.innerHTML = "<img>";
      window.onmessage = function() {
        bc.postMessage({command: "onmessage"});
        window.document.body.firstChild.src = msg.location;
        bc.close();
      };
      window.onbeforeunload = function() {
        window.postMessage("foo", "*");
      };

      history.back();
    }
  }
  window.onpageshow = function(e) {
    bc.postMessage({command: "child2PageShow", persisted: e.persisted});
  };
</script>