| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <body> | |
| 3 Test pageshow/pagehide event behavior when navigating away from a page with fram
es, putting the page in the page cache, then back to it. | |
| 4 <pre id="log"></pre> | |
| 5 <iframe src="resources/pageshow-pagehide-subframe-cachable.html"></iframe> | |
| 6 </body> | |
| 7 <script> | |
| 8 | |
| 9 if (window.testRunner) { | |
| 10 testRunner.dumpAsText(); | |
| 11 testRunner.waitUntilDone(); | |
| 12 testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1); | |
| 13 } | |
| 14 | |
| 15 function log(message) | |
| 16 { | |
| 17 // Logging to the console instead of the "log" DIV in the DOM because | |
| 18 // otherwise we trigger the assert mentioned at http://webkit.org/b/43152 | |
| 19 // (since we log during pagehide) | |
| 20 console.log(message); | |
| 21 } | |
| 22 | |
| 23 log("***Top level frame being parsed for the initial page load***"); | |
| 24 | |
| 25 window.onload = function(evt) { | |
| 26 log("Main frame window.onload"); | |
| 27 } | |
| 28 | |
| 29 window.onpageshow = function(evt) { | |
| 30 log("Main frame window.onpageshow" + ", target = " + evt.target + ", persist
ed = " + evt.persisted); | |
| 31 if (evt.persisted) { | |
| 32 if (window.testRunner) | |
| 33 testRunner.notifyDone(); | |
| 34 } else { | |
| 35 log("***Navigating top-level frame to a page that will immediately navig
ate back to this one***"); | |
| 36 // Location changes need to happen outside the onload handler to generat
e history entries. | |
| 37 setTimeout(function() {window.location.href = "data:text/html,<script>hi
story.back();</scr" + "ipt>";}, 0); | |
| 38 } | |
| 39 } | |
| 40 | |
| 41 window.onpagehide = function(evt) { | |
| 42 log("Main frame window.onpagehide" + ", target = " + evt.target + ", persist
ed = " + evt.persisted); | |
| 43 } | |
| 44 | |
| 45 </script> | |
| 46 </html> | |
| OLD | NEW |