Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / state-restore-hidden.html
blob861df726314c8c7b99570978639af5599baa21a2
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body onload="runTest()">
8 <div id="console"></div>
10 <input id="emptyOnFirstVisit" />
11 <form action="data:text/html,<script>history.back()&lt;/script>" name=f>
12 <input type="hidden" name="hidden" value="before" />
13 </form>
15 <script>
16 description("Bug 77391 - Hidden form elements do not save their state prior to form submission");
18 window.jsTestIsAsync = true;
20 function runTest() {
21 var state = document.getElementById("emptyOnFirstVisit");
22 if (!state.value) {
23 // First visit.
24 if (window.testRunner)
25 testRunner.waitUntilDone();
26 state.value = "visited";
28 document.f.hidden.value = "after";
29 // Submit form in a timeout to make sure that we create a new back/forward list item.
30 setTimeout(function() {document.f.submit();}, 0);
31 } else {
32 // Second visit.
33 shouldBeEqualToString("document.f.hidden.value", "after");
34 successfullyParsed = true;
36 finishJSTest();
39 </script>
40 </body>