Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
height: 2000px;
}
</style>
<script>
promiseTest(async () => {
let wheelEvents = 0;
let cancelableWheelEvents = 0;
window.addEventListener("wheel", event => {
++wheelEvents;
if (event.cancelable)
++cancelableWheelEvents;
}, { passive: true });
await animationFrame();
await animationFrame();
// The compositor takes a touchpad gesture from the UI at the top of the page, which no scroller can scroll up
// from, and stretches the page without asking the page first.
await internals.wheelThroughUIProcess(400, 300, 0, -200, true, "ongoing");
await internals.wheelThroughUIProcess(400, 300, 0, -200, true, "ongoing");
println(`pulled past the top: viewport stretch=${internals.compositorScrollState().stretch.y} window.scrollY=${window.scrollY}`);
println(`wheel events the page could have canceled: ${cancelableWheelEvents} of ${wheelEvents}`);
await internals.wheelThroughUIProcess(400, 300, 0, 0, true, "ended");
while (internals.compositorScrollState().stretch.y !== 0)
await animationFrame();
println(`sprung back: viewport stretch=${internals.compositorScrollState().stretch.y} window.scrollY=${window.scrollY}`);
// A mouse wheel from the UI at the top of the page never stretches it.
await internals.wheelThroughUIProcess(400, 300, 0, -400);
await animationFrame();
await animationFrame();
println(`mouse wheel: viewport stretch=${internals.compositorScrollState().stretch.y} window.scrollY=${window.scrollY}`);
});
</script>