forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Fix infinite loop in ChildNode's before() and after()
The loop that was supposed to check the chain of previous or next siblings had a logic mistake where it would never traverse the chain, so we would get stuck looking at the immediate sibling forever.
- Loading branch information
1 parent
ad843b6
commit 35f359c
Showing
5 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
Tests/LibWeb/Text/expected/DOM/ChildNode-after-next-sibling.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<DIV id="one" > | ||
<DIV id="two" > | ||
<DIV id="two" > | ||
<DIV id="one" > | ||
PASS (didn't crash) |
5 changes: 5 additions & 0 deletions
5
Tests/LibWeb/Text/expected/DOM/ChildNode-before-previous-sibling.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<DIV id="one" > | ||
<DIV id="two" > | ||
<DIV id="two" > | ||
<DIV id="one" > | ||
PASS (didn't crash) |
13 changes: 13 additions & 0 deletions
13
Tests/LibWeb/Text/input/DOM/ChildNode-after-next-sibling.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script src="../include.js"></script> | ||
<div id="one"></div><div id="two"></div><script> | ||
test(() => { | ||
let one = document.getElementById("one"); | ||
let two = document.getElementById("two"); | ||
one.after(two); | ||
printElement(one); | ||
printElement(one.nextSibling); | ||
printElement(two); | ||
printElement(two.previousSibling); | ||
println("PASS (didn't crash)"); | ||
}); | ||
</script> |
13 changes: 13 additions & 0 deletions
13
Tests/LibWeb/Text/input/DOM/ChildNode-before-previous-sibling.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script src="../include.js"></script> | ||
<div id="one"></div><div id="two"></div><script> | ||
test(() => { | ||
let one = document.getElementById("one"); | ||
let two = document.getElementById("two"); | ||
two.before(one); | ||
printElement(one); | ||
printElement(one.nextSibling); | ||
printElement(two); | ||
printElement(two.previousSibling); | ||
println("PASS (didn't crash)"); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters