summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/security/autocomplete-cleared-on-back.html
blob: e61cd1d31373e4acfd6c17295ed9b44d4e9f7613 (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
<html>
<head>
<script>

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

function log(message)
{
    var txt = document.createTextNode(message);
    document.getElementById("logger").appendChild(txt);
    document.getElementById("logger").appendChild(document.createElement('br'));
}

function runTest()
{
    if (!sessionStorage.secondPageReached) {
        document.getElementById("firstInput").value = "SuperSeekritValue";
        document.getElementById("secondInput").value = "SuperSeekritValue";
        // Location changes need to happen outside the onload handler to generate history entries.
        setTimeout(function() {window.location = "resources/autocomplete-cleared-on-back2.html";}, 0);
        return;
    }
    
    sessionStorage.removeItem("secondPageReached");
    
    log("Input value 1 - " + document.getElementById("firstInput").value);
    log("Input value 2 - " + document.getElementById("secondInput").value);
    
    if (window.testRunner)
        testRunner.notifyDone();
}

</script>
</head>
<body onload="runTest();">
This tests whether or not form input values that are designated autocomplete="off" retain their values after a navigation away from the page then returning back to it via the back button.
<form autocomplete="off">
<input type="text" id="firstInput"/>
</form>
<form>
<input autocomplete="off" id="secondInput"/>
</form>
<div id="logger"></div>
</body>
</html>