blob: 8559fe872c15fee75d159be109f5829adcf5ca64 [file] [log] [blame]
<html>
<script>
var timeoutValue = 100; //ms
var timestamp;
function verify() {
var actualTimerDelay = new Date().getTime() - timestamp;
document.getElementById("result").innerHTML =
actualTimerDelay >= timeoutValue ? 'PASS' : 'FAIL with ' + actualTimerDelay + ' ms delay.';
if (window.testRunner)
testRunner.notifyDone();
}
function runTest() {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
}
// Location changes need to happen outside the onload handler to generate history entries.
setTimeout(function() {
window.setTimeout(verify, timeoutValue);
timestamp = new Date().getTime();
window.location.href = "data:text/html,<body onload='history.back()'></body>";
}, 0);
}
</script>
<body onload='runTest()'>
This test verifies that when page is loaded from the page cache on navigation back, the suspended timers are resumed for a duration left when they were suspended. This is a test for https://bugs.webkit.org/show_bug.cgi?id=28683.<br>
The test navigates to a page, starts a timer and then navigates to another page and back. It then measures time when the timer is actually fired and makes sure that it is at least the time set at the beginning. If successful, it outputs 'PASS' below.
<div id="result"></div>
</body>
</html>