mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-18 23:12:02 +00:00
The basic idea is that style sheets can block script execution under some circumstances. With this commit, we now handle the simplest cases where a parser-inserted link element gets to download its style sheet before script execution continues. This improves performance on Speedometer 3 where JavaScript APIs that depend on layout results (like Element.scrollIntoView()) would get called too early (before the relevant CSS was downloaded), and so we'd perform premature layout work. This work then had to be redone after downloading the CSS anyway, wasting time. Note that our Text/input/link-re-enable-crash.html test had to be tweaked after these changes, since it relied on the old, incorrect, behavior where scripts would run before downloading CSS.
11 lines
299 B
HTML
11 lines
299 B
HTML
<!DOCTYPE html>
|
|
<script src="include.js"></script>
|
|
<script>
|
|
var scriptOnloadWasInvoked = false;
|
|
</script>
|
|
<link id="link" rel="stylesheet" href="valid.css" onload="link.disabled = true; link.disabled = false;">
|
|
<script>
|
|
test(() => {
|
|
println("PASS (didn't crash)");
|
|
});
|
|
</script>
|