mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
LibWeb: Stop crashing when textarea element is modified before insertion
If an element is created from JS, it might have its contents modified before it is inserted into the document. In this case, we don't have a shadow tree yet and so trying to set m_text_node's text content would cause a null dereference. So let's not do that. :^) That case also means that by the time we do create the shadow tree, we have the text content already, so we can set it there. Added a test to verify that we don't crash, and that the text content appears in the textarea whether it was inserted by JS or by the HTML parser.
This commit is contained in:
parent
883f44d397
commit
b1a569c1c5
3 changed files with 52 additions and 3 deletions
9
Tests/LibWeb/Layout/input/textarea-content.html
Normal file
9
Tests/LibWeb/Layout/input/textarea-content.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<body>
|
||||
<textarea>Bonjour mon amis!</textarea>
|
||||
<script>
|
||||
const textarea = document.createElement("textarea");
|
||||
textarea.innerText = "Well hello friends!";
|
||||
document.body.appendChild(textarea);
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue