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
parent cd276235d7
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

@ -27,10 +27,10 @@ void ConsoleGlobalEnvironmentExtensions::initialize(JS::Realm& realm)
{
Base::initialize(realm);
define_native_accessor(realm, "$0"_fly_string, $0_getter, nullptr, 0);
define_native_accessor(realm, "$_"_fly_string, $__getter, nullptr, 0);
define_native_function(realm, "$"_fly_string, $_function, 2, JS::default_attributes);
define_native_function(realm, "$$"_fly_string, $$_function, 2, JS::default_attributes);
define_native_accessor(realm, "$0"_utf16_fly_string, $0_getter, nullptr, 0);
define_native_accessor(realm, "$_"_utf16_fly_string, $__getter, nullptr, 0);
define_native_function(realm, "$"_utf16_fly_string, $_function, 2, JS::default_attributes);
define_native_function(realm, "$$"_utf16_fly_string, $$_function, 2, JS::default_attributes);
}
void ConsoleGlobalEnvironmentExtensions::visit_edges(Visitor& visitor)

View file

@ -78,7 +78,7 @@ static JsonValue serialize_js_value(JS::Realm& realm, JS::Value value)
}
if (value.is_symbol())
return MUST(value.as_symbol().descriptive_string());
return value.as_symbol().descriptive_string().to_utf8();
// FIXME: Handle serialization of object grips. For now, we stringify the object.
if (value.is_object()) {

View file

@ -1342,7 +1342,7 @@ Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_e
// 5. Let property be the result of calling the Object.[[GetProperty]](name) on element.
Web::HTML::TemporaryExecutionContext execution_context { current_browsing_context().active_document()->realm() };
if (auto property_or_error = element->get(name); !property_or_error.is_throw_completion()) {
if (auto property_or_error = element->get(Utf16FlyString::from_utf8(name)); !property_or_error.is_throw_completion()) {
auto property = property_or_error.release_value();
// 6. Let result be the value of property if not undefined, or null.

View file

@ -17,7 +17,7 @@
namespace WebContent {
static auto LADYBIRD_PROPERTY = JS::PropertyKey { "ladybird"_fly_string };
static auto LADYBIRD_PROPERTY = JS::PropertyKey { "ladybird"_utf16_fly_string };
static auto WEB_UI_LOADED_EVENT = "WebUILoaded"_fly_string;
static auto WEB_UI_MESSAGE_EVENT = "WebUIMessage"_fly_string;