[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / pagehide-timeout.html
1 <html>
2 <script src="../js/resources/js-test-pre.js"></script>
3 <body>
4
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.');
7
8 if (window.layoutTestController)
9     layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
10     
11 onpagehide = function()
12 {
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
19             // handler.
20             console.log('Timeout created in pagehide fired');
21             finishJSTest();
22         }, 100);
23     }
24 };
25
26 onpageshow = function(event)
27 {
28     if (event.persisted)
29         console.log('Restored page from page cache.');
30 }
31
32 onload = function()
33 {
34     setTimeout(function() {
35         location.href = 'resources/pagehide-timeout-go-back.html';
36     }, 0);
37 }
38 var jsTestIsAsync = true;
39 </script>
40 <script src="../js/resources/js-test-post.js"></script>
41 </body>
42 </html>