blob: ba53b93db10d1c7b757fd71a76b46a6384a68657 [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<style>
body {
height: 2000px;
}
</style>
</head>
<body>
<script>
description('Tests that scroll event listeners still work after going back to a page in the page cache.');
jsTestIsAsync = true;
function testScrollListener(message)
{
window.scrollBy(0, 10);
}
var scrollEventCount = 0;
window.addEventListener('scroll', function(e) {
++scrollEventCount;
}, false);
var pageShowCount = 0;
function onPageShow()
{
debug('pageshow ' + pageShowCount);
if (++pageShowCount == 2) {
testScrollListener('After going back');
shouldBecomeEqual('scrollEventCount', '1', finishJSTest);
}
}
function onPageLoad()
{
// Navigate in a timeout to make sure we create a history entry.
setTimeout(function() {
window.location.href = 'resources/jump-back.html';
}, 0);
};
window.addEventListener('load', onPageLoad, false);
window.addEventListener('pageshow', onPageShow, false);
</script>
</body>
</html>