summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-18 12:15:02 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-18 12:18:29 +0100
commit0639e778986877ef0a6883eb9011ad8b4f56b642 (patch)
tree32afd1a67fa823a59d25e4181c3503471b63c8f6 /Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp
parentfd83918476dd4d91a07df44c831275f0b5cdd7e9 (diff)
downloadserenity-0639e778986877ef0a6883eb9011ad8b4f56b642.zip
LibWeb: Make the Window object "inherit" from EventTarget :^)
Since Web::Bindings::WindowObject inherits from JS::GlobalObject, it cannot also inherit from Web::Bindings::EventTargetWrapper. However, that's not actually necessary. Instead, we simply set the Window object's prototype to the EventTargetPrototype, and add a little extra branch in the impl_from() function that turns the JS "this" value into a DOM::EventTarget*. With this, you can now call window.addEventListener()! Very cool :^) Fixes #4758.
Diffstat (limited to 'Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp
index cdefa63eff..1de64d81fb 100644
--- a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp
+++ b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp
@@ -65,7 +65,7 @@ bool Performance::dispatch_event(NonnullRefPtr<DOM::Event> event)
return DOM::EventDispatcher::dispatch(*this, event);
}
-Bindings::EventTargetWrapper* Performance::create_wrapper(JS::GlobalObject& global_object)
+JS::Object* Performance::create_wrapper(JS::GlobalObject& global_object)
{
return Bindings::wrap(global_object, *this);
}