mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 18:23:39 +00:00
LibWeb: Fix bogus insertion logic in HTMLTableSectionElement.insertRow()
Found by Domato :^)
This commit is contained in:
parent
7625d8a155
commit
c11f710628
Notes:
sideshowbarker
2024-07-17 08:13:43 +09:00
Author: https://github.com/awesomekling
Commit: c11f710628
Pull-request: https://github.com/SerenityOS/serenity/pull/23558
3 changed files with 16 additions and 1 deletions
4
Tests/LibWeb/Text/expected/HTML/tbody-insert-row.txt
Normal file
4
Tests/LibWeb/Text/expected/HTML/tbody-insert-row.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
2
|
||||||
|
[object HTMLTableRowElement]
|
||||||
|
[object HTMLTableRowElement]
|
||||||
|
PASS (didn't crash)
|
11
Tests/LibWeb/Text/input/HTML/tbody-insert-row.html
Normal file
11
Tests/LibWeb/Text/input/HTML/tbody-insert-row.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<table><tbody id="tbody"><tr></tr></tbody></table>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
tbody.insertRow(0);
|
||||||
|
println(tbody.rows.length)
|
||||||
|
println(tbody.rows[0])
|
||||||
|
println(tbody.rows[1])
|
||||||
|
println("PASS (didn't crash)");
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -66,7 +66,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableSectionEleme
|
||||||
TRY(append_child(table_row));
|
TRY(append_child(table_row));
|
||||||
// 4. Otherwise, insert table row as a child of this element, immediately before the index-th tr element in the rows collection.
|
// 4. Otherwise, insert table row as a child of this element, immediately before the index-th tr element in the rows collection.
|
||||||
else
|
else
|
||||||
table_row.insert_before(*this, rows_collection->item(index));
|
insert_before(table_row, rows_collection->item(index));
|
||||||
|
|
||||||
// 5. Return table row.
|
// 5. Return table row.
|
||||||
return JS::NonnullGCPtr(table_row);
|
return JS::NonnullGCPtr(table_row);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue