Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<iframe srcdoc="<script>internals.beginStyleTrace()</script><p>x</p>"></iframe>
<script>
// Have this document attach the user agent sheets, which has the process keep their rules.
internals.updateStyle();
asyncTest(done => {
const iframe = document.querySelector("iframe");
iframe.onload = () => {
// The frame reads the rules the process keeps, without recording or interning any of them itself.
const p = iframe.contentDocument.querySelector("p");
println(`margin-top from the user-agent sheet: ${iframe.contentWindow.getComputedStyle(p).marginTop}`);
iframe.contentWindow.internals.updateStyle();
const program = parseStyleTrace(iframe.contentWindow.internals.takeStyleTrace()).filter(event => event.event === "program");
println(`what the frame did to its rules: [${program.map(event => (event.times > 1 ? `${event.name} x${event.times}` : event.name)).join(", ")}]`);
done();
};
});
</script>