summaryrefslogtreecommitdiffstats
path: root/docshell/test/mochitest/file_bug1121701_1.html
blob: 3701bf2cadb429cf539a5837cbfc1cd28d03bd83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<script>
  var bc = new BroadcastChannel("file_bug1121701_1");
  var pageHideAsserts = undefined;
  bc.onmessage = (msgEvent) => {
    var msg = msgEvent.data;
    var command = msg.command;
    if (command == "setInnerHTML") {
      document.body.innerHTML = "modified";
      window.onpagehide = function(event) {
        window.onpagehide = null;
        pageHideAsserts = {};
        pageHideAsserts.persisted = event.persisted;
        pageHideAsserts.innerHTML = window.document.body.innerHTML;
      };
      window.location.href = msg.testUrl2;
    } else if (command == "close") {
      bc.postMessage({command: "closed"});
      bc.close();
      window.close();
    }
  }
  window.onpageshow = function(e) {
    var msg = {command: "child1PageShow", persisted: e.persisted, pageHideAsserts};
    msg.innerHTML = window.document.body.innerHTML;
    bc.postMessage(msg);
  };
</script>