Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / history / back-to-post.html
1 <html>
2 <body>
3 <p>Test for <a href="rdar://problem/6791439">rdar://problem/6791439</a>
4 Getting an error page instead of login page navigating back in gmail.</p>
5 <div id="result">FAIL: Script did not run</div>
6
7 <form action="back-to-post.html" method="post">
8 <input name="a" value="b">
9 <input id="mysubmit" type="submit" name="Submit" value="Submit">
10 </form>
11 <script>
12
13 function submitForm()
14 {
15     // Submit form in a timeout to make sure that we create a new back/forward list item.
16     setTimeout(function() {document.forms[0].submit()}, 0);
17 }
18
19 if (window.testRunner) {
20     testRunner.dumpAsText();
21     testRunner.waitUntilDone();
22     testRunner.setCustomPolicyDelegate(true, true);
23 }
24
25 var step = localStorage.getItem("back-to-post");
26 if (step == null) {
27     localStorage.setItem("back-to-post", "1");
28     submitForm();
29 } else if (step == "1") {
30     localStorage.setItem("back-to-post", "2");
31     submitForm();
32 } else if (step == "2") {
33     // Test that going back to form submission result works.
34     localStorage.setItem("back-to-post", "3");
35     history.back();
36 } else if (step == "3") {
37     localStorage.removeItem("back-to-post");
38     document.getElementById("result").innerHTML = 'PASS';
39     if (window.testRunner)
40         testRunner.notifyDone();
41 }
42 </script>
43 </body>
44 </html>