forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Use correct scope when removing style sheet inside a shadow tree
Before this change, removing a style element from inside a shadow tree would cause it to be unregistered with the document-level list of sheets instead of the shadow-root-level list. This would eventually lead to a verification failure if someone tried to update the text contents of that style element, since it was still in the shadow-root-level list, but now with a null owner element. Fixes a crash on https://www.swedbank.se/
- Loading branch information
1 parent
ebacb92
commit 3b7534b
Showing
6 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
Tests/LibWeb/Text/expected/ShadowDOM/remove-style-element-inside-shadow-tree.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,4 @@ | ||
hello [object StyleSheetList] | ||
Before remove, sheet count: 1 | ||
After remove, sheet count: 0 | ||
After setting innerText of removed sheet, we're still alive! |
20 changes: 20 additions & 0 deletions
20
Tests/LibWeb/Text/input/ShadowDOM/remove-style-element-inside-shadow-tree.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,20 @@ | ||
<div id=foo> | ||
<template shadowrootmode="open"> | ||
<style> | ||
div { border: 5px solid black; } | ||
</style> | ||
<div>hello</div> | ||
</template> | ||
</div> | ||
<script src="../include.js"></script> | ||
<script> | ||
test(() => { | ||
println(foo.shadowRoot.styleSheets); | ||
println("Before remove, sheet count: " + foo.shadowRoot.styleSheets.length); | ||
let style = foo.shadowRoot.firstElementChild; | ||
style.remove() | ||
println("After remove, sheet count: " + foo.shadowRoot.styleSheets.length); | ||
style.innerText = "div { border: 10px solid red; }"; | ||
println("After setting innerText of removed sheet, we're still alive!"); | ||
}); | ||
</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
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
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
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