Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / events / suspend-timers.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Suspend timers on navigate</title>
5 <style>
6     iframe {
7       display: block;
8       border: solid 1px #ccc;
9       margin: 1em;
10       width: 200px;
11       height: 200px;
12     }
13 </style>
14 <link rel="stylesheet" href="../js/resources/js-test-style.css">
15 <script src="../js/resources/js-test-pre.js"></script>
16 </head>
17 <body>
18
19 <iframe src="resources/suspend-subframe-1.html" id="a-frame"></iframe> <iframe src="resources/suspend-subframe-2.html" id="b-frame"></iframe>
20
21 <script type="text/javascript">
22 description('Tests that all JS timers are suspended after the pagehide event is fired, so that timers created within it will not fire while the document is in the page cache.');
23
24 if (window.testRunner)
25     testRunner.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
26
27
28 onpageshow = function(event)
29 {
30     if (event.persisted) {
31         console.log('Restored page from page cache.');
32         if (!window.wasFinishJSTestCalled) {
33             setTimeout(function() {
34                 finishJSTest();
35             }, 200);
36         }
37     }
38 }
39
40 onload = function()
41 {
42     setTimeout(function() {
43         location.href = 'resources/pagehide-timeout-go-back.html';
44     }, 10);
45 }
46
47 var successfullyParsed = true;
48 var jsTestIsAsync = true;
49 </script>
50 <script src="../js/resources/js-test-post.js"></script>
51 </body>
52 </html>
53