Skip to content

Truly independent web browser

LibWeb: Keep ASCII storage for ASCII `TextDecoder` output

Tim Ledbettera058edf8f09b
diff --git a/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs b/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs
index 631b795c68b..369d765a3e6 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs
@@ -87,7 +87,7 @@ impl UsvString {
/// The string of the code units, with U+FFFD in place of every surrogate that is not part of a pair.
pub(crate) fn from_utf16_replacing_lone_surrogates(code_units: &[u16]) -> Self {
- Self(Utf16String::well_formed_from_utf16(code_units))
+ Self(to_well_formed(&Utf16String::from_utf16(code_units)))
}
}
diff --git a/Tests/LibWeb/Crash/Encoding/text-decoder-ascii-output-as-locale.html b/Tests/LibWeb/Crash/Encoding/text-decoder-ascii-output-as-locale.html
new file mode 100644
index 00000000000..f6376838dec
--- /dev/null
+++ b/Tests/LibWeb/Crash/Encoding/text-decoder-ascii-output-as-locale.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<script>
+ new Intl.Collator(new TextDecoder().decode(new Uint8Array([101, 110])));
+</script>