2 <script src="../js/resources/js-test-pre.js"></script>
5 <script type="text/javascript">
6 description('Tests that JS execution is suspended after the pagehide event is fired, so that timers created within it will not fire while the document is in the page cache.');
8 if (window.layoutTestController)
9 layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
11 onpagehide = function()
13 // Don't try to create the timeout again if the test is complete and we're
14 // moving to the next one.
15 if (!window.wasFinishJSTestCalled) {
16 console.log('Creating timeout in pagehide');
17 setTimeout(function() {
18 // This log statement should happen after the one done in the pageshow
20 console.log('Timeout created in pagehide fired');
26 onpageshow = function(event)
29 console.log('Restored page from page cache.');
34 setTimeout(function() {
35 location.href = 'resources/pagehide-timeout-go-back.html';
38 var jsTestIsAsync = true;
40 <script src="../js/resources/js-test-post.js"></script>