1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:07:34 +00:00

LibWeb: Remove no-op impl() methods from the WEB_PLATFORM_OBJECT macro

These are leftovers from when wrapper objects still had an internal
implementation, which is no longer the case.
This commit is contained in:
Linus Groh 2022-09-21 17:45:18 +01:00
parent 2cab2a8e8f
commit 6055b0e850
14 changed files with 28 additions and 39 deletions

View file

@ -40,7 +40,7 @@ JS::ThrowCompletionOr<JS::Object*> AudioConstructor::construct(FunctionObject&)
// 1. Let document be the current global object's associated Document.
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
auto& document = window.impl().associated_document();
auto& document = window.associated_document();
// 2. Let audio be the result of creating an element given document, audio, and the HTML namespace.
auto audio = DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML);

View file

@ -108,12 +108,12 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter)
// 2. Parse the given value relative to the entry settings object. If that failed, throw a TypeError exception.
auto new_href = TRY(vm.argument(0).to_string(vm));
auto href_url = window.impl().associated_document().parse_url(new_href);
auto href_url = window.associated_document().parse_url(new_href);
if (!href_url.is_valid())
return vm.throw_completion<JS::URIError>(String::formatted("Invalid URL '{}'", new_href));
// 3. Location-object navigate given the resulting URL record.
window.impl().did_set_location_href({}, href_url);
window.did_set_location_href({}, href_url);
return JS::js_undefined();
}
@ -226,7 +226,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::port_getter)
JS_DEFINE_NATIVE_FUNCTION(LocationObject::reload)
{
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
window.impl().did_call_location_reload({});
window.did_call_location_reload({});
return JS::js_undefined();
}
@ -236,7 +236,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::replace)
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
auto url = TRY(vm.argument(0).to_string(vm));
// FIXME: This needs spec compliance work.
window.impl().did_call_location_replace({}, move(url));
window.did_call_location_replace({}, move(url));
return JS::js_undefined();
}

View file

@ -14,15 +14,7 @@
namespace Web::Bindings {
#define WEB_PLATFORM_OBJECT(class_, base_class) \
JS_OBJECT(class_, base_class) \
auto& impl() \
{ \
return *this; \
} \
auto const& impl() const \
{ \
return *this; \
}
JS_OBJECT(class_, base_class)
#define WRAPPER_HACK(class_, namespace_) \
namespace Web::Bindings { \

View file

@ -151,7 +151,7 @@ JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const
// 1. Let W be the value of the [[Window]] internal slot of this.
// 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current settings object.
HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).impl().browsing_context(), *m_window->browsing_context(), property_key, HTML::current_settings_object());
HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).browsing_context(), *m_window->browsing_context(), property_key, HTML::current_settings_object());
// 3. If IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver).
// NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method.
@ -171,7 +171,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& pro
// 1. Let W be the value of the [[Window]] internal slot of this.
// 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current settings object.
HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).browsing_context(), *m_window->impl().browsing_context(), property_key, HTML::current_settings_object());
HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).browsing_context(), *m_window->browsing_context(), property_key, HTML::current_settings_object());
// 3. If IsPlatformObjectSameOrigin(W) is true, then:
if (is_platform_object_same_origin(*m_window)) {