LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16

This has quite a lot of fall out. But the majority of it is just type or
UDL substitution, where the changes just fall through to other function
calls.

By changing property key storage to UTF-16, the main affected areas are:
* NativeFunction names must now be UTF-16
* Bytecode identifiers must now be UTF-16
* Module/binding names must now be UTF-16
This commit is contained in:
Timothy Flynn 2025-08-02 19:27:29 -04:00 committed by Tim Flynn
commit 0efa98a57a
Notes: github-actions[bot] 2025-08-05 11:08:30 +00:00
131 changed files with 766 additions and 726 deletions

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/Utf16FlyString.h>
#include <LibGC/Ptr.h>
#include <LibJS/Export.h>
#include <LibJS/ModuleLoading.h>
@ -39,7 +39,7 @@ struct ResolvedBinding {
Type type { Null };
GC::Ptr<Module> module;
FlyString export_name;
Utf16FlyString export_name;
bool is_valid() const
{
@ -110,10 +110,10 @@ public:
virtual ThrowCompletionOr<void> link(VM& vm) = 0;
virtual ThrowCompletionOr<GC::Ref<Promise>> evaluate(VM& vm) = 0;
Vector<FlyString> get_exported_names(VM& vm);
virtual Vector<FlyString> get_exported_names(VM& vm, HashTable<Module const*>& export_star_set) = 0;
Vector<Utf16FlyString> get_exported_names(VM& vm);
virtual Vector<Utf16FlyString> get_exported_names(VM& vm, HashTable<Module const*>& export_star_set) = 0;
virtual ResolvedBinding resolve_export(VM& vm, FlyString const& export_name, Vector<ResolvedBinding> resolve_set = {}) = 0;
virtual ResolvedBinding resolve_export(VM& vm, Utf16FlyString const& export_name, Vector<ResolvedBinding> resolve_set = {}) = 0;
virtual ThrowCompletionOr<u32> inner_module_linking(VM& vm, Vector<Module*>& stack, u32 index);
virtual ThrowCompletionOr<u32> inner_module_evaluation(VM& vm, Vector<Module*>& stack, u32 index);
@ -131,7 +131,7 @@ protected:
}
private:
GC::Ref<Object> module_namespace_create(Vector<FlyString> unambiguous_names);
GC::Ref<Object> module_namespace_create(Vector<Utf16FlyString> unambiguous_names);
ThrowCompletionOr<void> evaluate_module_sync(VM&);
// These handles are only safe as long as the VM they live in is valid.