chromium/third_party/blink/web_tests/http/tests/history/back-to-post.html

<html>
<body>
<p>Test for <a href="rdar://problem/6791439">rdar://problem/6791439</a>
Getting an error page instead of login page navigating back in gmail.</p>
<div id="result">FAIL: Script did not run</div>

<form action="back-to-post.html" method="post">
<input name="a" value="b">
<input id="mysubmit" type="submit" name="Submit" value="Submit">
</form>
<script>

function submitForm()
{
    // Submit form in a timeout to make sure that we create a new back/forward list item.
    setTimeout(function() {document.forms[0].submit()}, 0);
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    testRunner.setCustomPolicyDelegate(true, true);
}

var step = localStorage.getItem("back-to-post");
if (step == null) {
    localStorage.setItem("back-to-post", "1");
    submitForm();
} else if (step == "1") {
    localStorage.setItem("back-to-post", "2");
    submitForm();
} else if (step == "2") {
    // Test that going back to form submission result works.
    localStorage.setItem("back-to-post", "3");
    history.back();
} else if (step == "3") {
    localStorage.removeItem("back-to-post");
    document.getElementById("result").innerHTML = 'PASS';
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</body>
</html>