2008-12-11 Cameron Zwarich <zwarich@apple.com>
[WebKit-https.git] / LayoutTests / security / autocomplete-cleared-on-back.html
1 <html>
2 <head>
3 <script>
4
5 if (window.layoutTestController) {
6     layoutTestController.dumpAsText();
7     layoutTestController.waitUntilDone();
8 }
9
10 function log(message)
11 {
12     var txt = document.createTextNode(message);
13     document.getElementById("logger").appendChild(txt);
14     document.getElementById("logger").appendChild(document.createElement('br'));
15 }
16
17 function runTest()
18 {
19     if (!sessionStorage.secondPageReached) {
20         document.getElementById("firstInput").value = "SuperSeekritValue";
21         document.getElementById("secondInput").value = "SuperSeekritValue";
22         window.location = "resources/autocomplete-cleared-on-back2.html";
23         return;
24     }
25     
26     sessionStorage.removeItem("secondPageReached");
27     
28     log("Input value 1 - " + document.getElementById("firstInput").value);
29     log("Input value 2 - " + document.getElementById("secondInput").value);
30     
31     if (window.layoutTestController)
32         layoutTestController.notifyDone();
33 }
34
35 </script>
36 </head>
37 <body onload="runTest();">
38 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.
39 <form autocomplete="off">
40 <input type="text" id="firstInput"/>
41 </form>
42 <form>
43 <input autocomplete="off" id="secondInput"/>
44 </form>
45 <div id="logger"></div>
46 </body>
47 </html>