diff options
author | Linus Groh <mail@linusgroh.de> | 2022-10-27 23:23:03 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-29 15:48:46 +0100 |
commit | de3e6cc75c84f45beed24042e093647ea96d56a2 (patch) | |
tree | d1bfdc82925a0fa20706e1355e646686c352a667 /Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp | |
parent | 9cda0b2b2c8fde26723a4b9364450dd73b9301c5 (diff) | |
download | serenity-de3e6cc75c84f45beed24042e093647ea96d56a2.zip |
LibWeb: Ensure dom_exception_to_throw_completion() always takes a VM
The combination of template + auto&& parameter + constexpr if statements
allowed one caller to pass in a GlobalObject, without the compiler
complaining.
Diffstat (limited to 'Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp b/Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp index ae53ec4513..407feac4ce 100644 --- a/Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp @@ -64,8 +64,7 @@ JS::ThrowCompletionOr<bool> LegacyPlatformObject::is_named_property_exposed_on_o JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LegacyPlatformObject::legacy_platform_object_get_own_property_for_get_own_property_slot(JS::PropertyKey const& property_name) const { - - [[maybe_unused]] auto& global_object = this->global_object(); + auto& vm = this->vm(); if (property_name.is_number()) { // 1. Let index be the result of calling ToUint32(P). @@ -75,7 +74,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LegacyPlatformObject::le // FIXME: Can this throw? if (is_supported_property_index(index)) { - auto value = TRY(throw_dom_exception_if_needed(global_object, [&] { return item_value(index); })); + auto value = TRY(throw_dom_exception_if_needed(vm, [&] { return item_value(index); })); // 5. Let desc be a newly created Property Descriptor with no fields. JS::PropertyDescriptor descriptor; @@ -102,7 +101,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LegacyPlatformObject::le // FIXME: It's unfortunate that this is done twice, once in is_named_property_exposed_on_object and here. auto property_name_string = property_name.to_string(); - auto value = TRY(throw_dom_exception_if_needed(global_object, [&] { return named_item_value(property_name_string); })); + auto value = TRY(throw_dom_exception_if_needed(vm, [&] { return named_item_value(property_name_string); })); // 5. Let desc be a newly created Property Descriptor with no fields. JS::PropertyDescriptor descriptor; |