blob: 1a0ed1008330b354c27d903b236813f210e903d7 [file] [log] [blame]
<!-- webkit-test-runner [ enableBackForwardCache=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>