LibWeb: Implement USVString scalar value handling

USVString is defined in the IDL spec as:

> The USVString type corresponds to scalar value strings. Depending on
> the context, these can be treated as sequences of either 16-bit
> unsigned integer code units or scalar values.

This means we need to account for surrogate code points by using the
replacement character.

This fixes the last test in https://wpt.live/url/url-constructor.any.html
This commit is contained in:
Shannon Booth 2024-08-07 18:42:14 +12:00 committed by Tim Ledbetter
commit aa32bfa448
Notes: github-actions[bot] 2024-08-08 09:50:59 +00:00
3 changed files with 32 additions and 4 deletions

View file

@ -37,6 +37,7 @@
{ input: '/c:/foo/bar', base: 'file:///c:/baz/qux' },
{ input: '', base: 'file:///test?test#test' },
{ input: '??a=b&c=d', base: 'http://example.org/foo/bar' },
{ input: 'http://example.com/\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF?\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF' },
];
for (url of urls) {