mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 11:39:43 +00:00
LibWeb: Don't crash on getClientRects() in document without navigable
I previously believed there was no way a detached document should have layout information, but it turns out there is a way: getComputedStyle(). So we need to account for cases where we have a layout node, but no navigable, since that is a state we can get into at this moment. Fixes #354
This commit is contained in:
parent
41cf9f6fe3
commit
1e7b17f150
Notes:
github-actions[bot]
2024-08-05 12:56:54 +00:00
Author: https://github.com/awesomekling
Commit: 1e7b17f150
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/971
3 changed files with 24 additions and 5 deletions
|
@ -0,0 +1,16 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let doc = document.implementation.createHTMLDocument();
|
||||
let div = doc.createElement("div");
|
||||
doc.body.appendChild(div);
|
||||
|
||||
// NOTE: We do a getComputedStyle() to trick the document into doing some style/layout work.
|
||||
// In the future, we may optimize away some of this work, which would potentially
|
||||
// make the test not work as intended anymore.
|
||||
println(getComputedStyle(div));
|
||||
|
||||
println(div.getClientRects());
|
||||
println("PASS (didn't crash)");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue