summaryrefslogtreecommitdiffstats
path: root/docshell/test/mochitest/file_bug1850335_1.html
blob: f317d2197aa6b2c7b77ebce3e0eede263f52ea40 (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>
addEventListener("load", ({ persisted }) => {
  document.getElementById("input1").value = "";
});
addEventListener("pageshow", ({ persisted }) => {
  let bc = new BroadcastChannel("bug1850335");

  bc.addEventListener("message", ({ data: { cmd, arg } }) => {
    if (cmd == "setValue") {
      document.getElementById("input1").value = arg;
      bc.postMessage({ value: document.getElementById("input1").value });
    } else if (cmd == "load") {
      bc.close();
      location = arg;
    } else if (cmd == "close") {
      close();
    }
  });

  bc.postMessage({ persisted, value: document.getElementById("input1").value });
});
</script>
<input type="text" id="input1"></input>