summaryrefslogtreecommitdiffstats
path: root/docshell/test/mochitest/file_form_restoration_no_store.html
blob: 6e8756a69346181ade10eca12fc5b0892a7d6a45 (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
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <script>
    window.addEventListener("pageshow", ({ persisted }) => {
      let bc = new BroadcastChannel("form_restoration");
      bc.addEventListener("message", ({ data }) => {
        switch (data) {
          case "enter_data":
            document.getElementById("formElement").value = "test";
            break;
          case "reload":
            bc.close();
            location.reload();
            break;
          case "navigate":
            bc.close();
            document.location = "file_form_restoration_no_store.html?1";
            break;
          case "back":
            bc.close();
            history.back();
            break;
          case "close":
            bc.close();
            window.close();
            break;
        }
      });
      bc.postMessage({ persisted, formData: document.getElementById("formElement").value });
    });
  </script>
</head>
<body>
  <input id="formElement" type="text" value="initial">
</body>
</html>