Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
height: 2000px;
}
iframe {
display: block;
width: 200px;
height: 150px;
border: 0;
}
</style>
<script>
promiseTest(async () => {
const frame = document.createElement("iframe");
const frameLoaded = new Promise(resolve => frame.addEventListener("load", resolve, { once: true }));
frame.srcdoc = "<body style='margin: 0; height: 300px'></body>";
document.body.prepend(frame);
await frameLoaded;
await waitForCondition(() => internals.compositorWheelTargetAt(100, 75, 0, 50).document === frame.contentDocument);
let frameScrollends = 0;
frame.contentDocument.addEventListener("scrollend", () => frameScrollends++);
// The fingers of a touchpad gesture that rest on the touchpad keep the gesture going until they lift, however
// long they rest, so the steps after the rest stay with the frame at its edge rather than scroll the page.
for (let step = 0; step < 2; step++)
await internals.wheelThroughUIProcess(100, 75, 0, 100, true, "ongoing");
await new Promise(resolve => setTimeout(resolve, 600));
for (let step = 0; step < 2; step++)
await internals.wheelThroughUIProcess(100, 75, 0, 100, true, "ongoing");
await animationFrame();
await animationFrame();
println(`Before the fingers lift: frame scrollY ${frame.contentWindow.scrollY}, page scrollY ${window.scrollY}, frame scrollend events: ${frameScrollends}`);
await internals.wheelThroughUIProcess(100, 75, 0, 0, true, "ended");
for (let frameCount = 0; frameCount < 3; frameCount++)
await animationFrame();
println(`After they lift: frame scrollY ${frame.contentWindow.scrollY}, page scrollY ${window.scrollY}, frame scrollend events: ${frameScrollends}`);
});
</script>