summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/button-state-restore.html
blob: 2f97f7eeca2ee12bccf5b0eb96522d0c8c47f871 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
    <script>
        function loaded()
        {
            var beenHere = document.getElementById("beenHere");
            var input = document.getElementById("input");

            if (beenHere.value) {
                var result = "FAIL";
                // Button value is not restored.
                if (input.value == "PASS") {
                    beenHere.value = "PASS";
                    result = "PASS";
                }

                document.getElementById("result").innerText = result;

                if (window.layoutTestController)
                    layoutTestController.notifyDone();
                return;
            }

            if (window.layoutTestController) {
                layoutTestController.dumpAsText();
                layoutTestController.waitUntilDone();
            }

            beenHere.value = "FAIL";

            input.value = "FAIL";

            var form = document.getElementById("form");
            form.submit();
        }
    </script>
</head>
<!-- the unload handler keeps this page out of the B/F cache -->
<body onunload="" onload="loaded()">
    <p>
        This is a test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=14400">http://bugs.webkit.org/show_bug.cgi?id=14400</a>
        Assertion failure (SHOULD NEVER BE REACHED) going back on YouTube</i>.
    </p>
    <p>
        Test result: <span id="result">test did not complete</span>
    </p>
    <button type="button" name="foo">Button</button>
    <input id="input" type="button" name="foo" value="PASS">
    <input id="beenHere">
    <form action="data:text/html,<script>history.back()</script>" method="POST" id="form"></form>
</body>
</html>