summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/suspend_blank.html
blob: b6dd0075e6b987c1f08f9ce307f7652ceda96a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE HTML>
<script>
  var interval;
  var finish = false;
  var bc = new BroadcastChannel("suspendBlank");
  bc.onmessage = (msgEvent) => {
    var msg = msgEvent.data;
    var command = msg.command;
    if (command == "navigateBack") {
      finish = true;
      history.back();
    }
  }
  window.onpagehide = () => {
    bc.postMessage({command: "pagehide"});
    if (finish) {
      bc.close();
    }
  }
  window.onload = () => {
    bc.postMessage({command: "loaded"});
  }
</script>