Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb: Creating a ClassicScript takes incorrect input type #17900

Open
ADKaster opened this issue Mar 17, 2023 · 0 comments
Open

LibWeb: Creating a ClassicScript takes incorrect input type #17900

ADKaster opened this issue Mar 17, 2023 · 0 comments

Comments

@ADKaster
Copy link
Member

Per https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script , the input source is supposed to be a string, which, per https://infra.spec.whatwg.org/#string is

A string is a sequence of unsigned 16-bit integers, also known as code units. A string is also known as a JavaScript string. Strings are denoted by double quotes and monospace font.

This is distinct from a "byte string", i.e. AK::StringView/AK::DeprecatedString, and from a UTF-8 string aka AK::String. The spec suggests the input should be Span<u16>. Which seems quite gross.

If we intend to implement the algorithm taking a UTF-8 string, we should make that explicit with implementation note comments. And if we intend to make assumptions about the UTF-8-ness of a string in that algorithm, we should validate the input being UTF-8 either before calling it, after calling it, or as part of another spec step, such as the one that calls https://tc39.es/ecma262/#sec-parse-script (see #17899)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant