blob: c4cdc0409212ad502969c02dff528b38ce3facf9 [file] [log] [blame]
<html>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<body>
<script type="text/javascript">
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.');
if (window.layoutTestController)
layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
onpagehide = function()
{
// Don't try to create the timeout again if the test is complete and we're
// moving to the next one.
if (!window.wasFinishJSTestCalled) {
console.log('Creating timeout in pagehide');
setTimeout(function() {
// This log statement should happen after the one done in the pageshow
// handler.
console.log('Timeout created in pagehide fired');
finishJSTest();
}, 100);
}
};
onpageshow = function(event)
{
if (event.persisted)
console.log('Restored page from page cache.');
}
onload = function()
{
setTimeout(function() {
location.href = 'resources/pagehide-timeout-go-back.html';
}, 0);
}
var successfullyParsed = true;
var jsTestIsAsync = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>