LibWeb: Allow splitting surrogate pairs in CharacterData.replaceData()

We're expected to handle this situation gracefully, and certainly not
by falling apart like we were.

Found by Domato.
This commit is contained in:
Andreas Kling 2024-07-19 20:02:14 +02:00 committed by Andreas Kling
commit 33207174a9
Notes: github-actions[bot] 2024-07-20 04:41:59 +00:00
3 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,16 @@
<script src="../include.js"></script>
<script>
test(() => {
const str = '\uD2ED\uDEA6';
let t = document.createTextNode(str);
println("Before replaceData:");
for (let i = 0; i < t.length; ++i) {
println("[" + i + "]: " + t.data.charCodeAt(i));
}
t.replaceData(0, 1, '')
println("After replaceData:");
for (let i = 0; i < t.length; ++i) {
println("[" + i + "]: " + t.data.charCodeAt(i));
}
});
</script>