mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibWeb: Make Event.currentTarget return WindowProxy instead of Window
Make WindowProxy implement the EventTarget interface. Add a new method current_target_for_bindings() that returns a WindowProxy object instead of directly exposing the Window object. These changes fixes several WPT tests that contain `window === currentTarget`.
This commit is contained in:
parent
373b2838db
commit
d4df0e1db9
Notes:
github-actions[bot]
2025-10-15 13:38:06 +00:00
Author: https://github.com/mikiubo
Commit: d4df0e1db9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6207
Reviewed-by: https://github.com/gmta ✅
17 changed files with 103 additions and 27 deletions
|
@ -10,13 +10,14 @@
|
|||
#include <LibGC/Ptr.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/Export.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
class WEB_API WindowProxy final : public JS::Object {
|
||||
JS_OBJECT(WindowProxy, JS::Object);
|
||||
class WEB_API WindowProxy final : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(WindowProxy, DOM::EventTarget)
|
||||
GC_DECLARE_ALLOCATOR(WindowProxy);
|
||||
|
||||
public:
|
||||
|
@ -33,8 +34,6 @@ public:
|
|||
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
|
||||
virtual JS::ThrowCompletionOr<GC::RootVector<JS::Value>> internal_own_property_keys() const override;
|
||||
|
||||
virtual bool eligible_for_own_property_enumeration_fast_path() const override final { return false; }
|
||||
|
||||
GC::Ptr<Window> window() const { return m_window; }
|
||||
void set_window(GC::Ref<Window>);
|
||||
|
||||
|
@ -43,6 +42,8 @@ public:
|
|||
private:
|
||||
explicit WindowProxy(JS::Realm&);
|
||||
|
||||
virtual bool is_window_or_worker_global_scope_mixin() const final { return true; }
|
||||
|
||||
virtual bool is_html_window_proxy() const override { return true; }
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue