summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
index 1f9b174e1b..989db89812 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -24,6 +24,7 @@
#include <LibWeb/Bindings/NavigatorObject.h>
#include <LibWeb/Bindings/NodeWrapperFactory.h>
#include <LibWeb/Bindings/PerformanceWrapper.h>
+#include <LibWeb/Bindings/Replaceable.h>
#include <LibWeb/Bindings/ScreenWrapper.h>
#include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/Document.h>
@@ -89,7 +90,7 @@ void WindowObject::initialize_global_object()
define_native_function("scrollBy", scroll_by, 2, attr);
// Legacy
- define_native_accessor("event", event_getter, {}, JS::Attribute::Enumerable);
+ define_native_accessor("event", event_getter, event_setter, JS::Attribute::Enumerable);
define_direct_property("navigator", heap().allocate<NavigatorObject>(*this, *this), JS::Attribute::Enumerable | JS::Attribute::Configurable);
define_direct_property("location", heap().allocate<LocationObject>(*this, *this), JS::Attribute::Enumerable | JS::Attribute::Configurable);
@@ -439,6 +440,11 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::event_getter)
return wrap(global_object, const_cast<DOM::Event&>(*impl->current_event()));
}
+JS_DEFINE_NATIVE_FUNCTION(WindowObject::event_setter)
+{
+ REPLACEABLE_PROPERTY_SETTER(WindowObject, event);
+}
+
JS_DEFINE_NATIVE_FUNCTION(WindowObject::inner_width_getter)
{
auto* impl = impl_from(vm, global_object);
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h
index d574546740..7a5f014980 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h
@@ -68,6 +68,7 @@ private:
JS_DECLARE_NATIVE_FUNCTION(screen_getter);
JS_DECLARE_NATIVE_FUNCTION(event_getter);
+ JS_DECLARE_NATIVE_FUNCTION(event_setter);
JS_DECLARE_NATIVE_FUNCTION(inner_width_getter);
JS_DECLARE_NATIVE_FUNCTION(inner_height_getter);