41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
|
|
<html>
|
|
<script src="../../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.');
|
|
|
|
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 jsTestIsAsync = true;
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|