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; }
#outer:hover { background-color: rgb(0, 128, 0); }
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; background-color: rgb(0, 0, 255) } #inner:hover { background-color: rgb(0, 128, 0) }</style><div id=inner></div>"></iframe>
<script>
// Beside a task, the pointer moves over a same-process iframe and back out of it. The lane of the iframe's document
// hears that the pointer left, and hovers nothing; the rendering update after the task hovers the element outside.
asyncTest(async done => {
const iframe = document.querySelector("iframe");
await srcdocLoaded(iframe);
const inner = iframe.contentDocument.getElementById("inner");
const result = await whileLaneHovers(frameTime => {
internals.injectHoverPointer(80, 50, frameTime + 16, 1);
iframe.contentWindow.internals.injectClockTick(frameTime + 16);
const inside = internals.lastFramePresentedBy(iframe.contentDocument);
internals.injectHoverPointer(20, 50, frameTime + 32, 2);
iframe.contentWindow.internals.injectClockTick(frameTime + 32);
return { inside, outside: internals.lastFramePresentedBy(document) };
}, [document, iframe.contentDocument]);
println(`the iframe's frame as the pointer is over it presented by: ${result.inside}`);
println(`the frame once the pointer left the iframe presented by: ${result.outside}`);
await twoFrames();
println(`#inner matches :hover: ${inner.matches(":hover")}`);
println(`#outer matches :hover: ${outer.matches(":hover")}`);
done();
});
</script>