LibJS: Port the Identifier AST (and related) nodes to UTF-16

This eliminates quite a lot of UTF-8 / UTF-16 churn.
This commit is contained in:
Timothy Flynn
2025-08-06 11:12:58 -04:00
committed by Tim Flynn
parent 00182a2405
commit b955c9b2a9
Notes: github-actions[bot] 2025-08-13 13:57:20 +00:00
20 changed files with 206 additions and 238 deletions

View File

@@ -418,9 +418,9 @@ void initialize_main_thread_vm(AgentType type)
};
// 8.1.6.7.2 HostGetSupportedImportAttributes(), https://html.spec.whatwg.org/multipage/webappapis.html#hostgetsupportedimportassertions
s_main_thread_vm->host_get_supported_import_attributes = []() -> Vector<String> {
s_main_thread_vm->host_get_supported_import_attributes = []() -> Vector<Utf16String> {
// 1. Return « "type" ».
return { "type"_string };
return { "type"_utf16 };
};
// 8.1.6.7.3 HostLoadImportedModule(referrer, moduleRequest, loadState, payload), https://html.spec.whatwg.org/multipage/webappapis.html#hostloadimportedmodule
@@ -494,7 +494,7 @@ void initialize_main_thread_vm(AgentType type)
// 2. Resolve a module specifier given referencingScript and moduleRequest.[[Specifier]], catching any
// exceptions. If they throw an exception, let resolutionError be the thrown exception.
auto maybe_exception = HTML::resolve_module_specifier(referencing_script, module_request.module_specifier.to_string());
auto maybe_exception = HTML::resolve_module_specifier(referencing_script, module_request.module_specifier.view().to_utf8_but_should_be_ported_to_utf16());
// 3. If the previous step threw an exception, then:
if (maybe_exception.is_exception()) {
@@ -544,7 +544,7 @@ void initialize_main_thread_vm(AgentType type)
// 8. Let url be the result of resolving a module specifier given referencingScript and moduleRequest.[[Specifier]],
// catching any exceptions. If they throw an exception, let resolutionError be the thrown exception.
auto url = HTML::resolve_module_specifier(referencing_script, module_request.module_specifier.to_string());
auto url = HTML::resolve_module_specifier(referencing_script, module_request.module_specifier.view().to_utf8_but_should_be_ported_to_utf16());
// 9. If the previous step threw an exception, then:
if (url.is_exception()) {