1 <html> 2 <head> 3 <script> 4 5 if (window.layoutTestController) { 6 layoutTestController.dumpAsText(); 7 layoutTestController.waitUntilDone(); 8 layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1); 9 } 10 11 function runTest() 12 { 13 var input = document.getElementById("testinput"); 14 input.setAttribute("autocomplete", "on"); 15 input.parentNode.removeChild(input); 16 17 // Location changes need to happen outside the onload handler to generate history entries. 18 setTimeout(function() {window.location = "data:text/html,<script>history.back();</scrip" + "t>";}, 0); 19 } 20 21 function pageHidden() 22 { 23 if (!sessionStorage.finishTest) { 24 console.log('navigating away'); 25 sessionStorage.finishTest = true; 26 } else { 27 // Clean up after ourselves 28 delete sessionStorage.finishTest; 29 } 30 } 31 32 function pageShown() 33 { 34 if (sessionStorage.finishTest) { 35 console.log('navigated back'); 36 if (window.layoutTestController) 37 layoutTestController.notifyDone(); 38 } else { 39 runTest(); 40 } 41 } 42 43 </script> 44 </head> 45 46 <body onpagehide="pageHidden();" onpageshow="pageShown();"> 47 <pre>This test has an input element that starts out with autocomplete=off. 48 It then changes autocomplete to on. 49 It then removes the element so it is destroyed. 50 It then navigates to a new page, placing the current page in the page cache. 51 Finally it returns to the original page.</pre> 52 <form> 53 <input id="testinput" autocomplete="off"> 54 </form> 55 </body> 56