Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
body { margin: 0; display: flex; }
#outer { width: 50px; height: 100px; flex: none; }
iframe { display: block; width: 200px; height: 100px; border: 0; flex: none; }
</style>
<div id="outer"></div>
<iframe srcdoc="<style>body { margin: 0 } #inner { width: 100px; height: 100px }</style><div id=inner></div>"></iframe>
<script>
// Beside a task, the lane hovers an element of the document, and the pointer then moves on over a same-process
// iframe, whose lane hovers the move. The rendering update after the task handles the mouse event of that move,
// which goes to the iframe's element under the pointer, not to the element the document's lane hovered before.
asyncTest(async done => {
const iframe = document.querySelector("iframe");
await srcdocLoaded(iframe);
const inner = iframe.contentDocument.getElementById("inner");
const targets = [];
outer.addEventListener("mousemove", () => targets.push("outer"));
inner.addEventListener("mousemove", () => targets.push("inner"));
await whileLaneHovers(frameTime => {
const id = internals.queueMouseMove(80, 50);
internals.injectHoverPointer(20, 50, frameTime + 16, id - 1);
internals.injectHoverPointer(80, 50, frameTime + 32, id);
iframe.contentWindow.internals.injectClockTick(frameTime + 48);
}, [document, iframe.contentDocument]);
await twoFrames();
println(`mousemove targets: ${targets.join(", ")}`);
println(`#outer matches :hover: ${outer.matches(":hover")}`);
println(`#inner matches :hover: ${inner.matches(":hover")}`);
done();
});
</script>