Procházet zdrojové kódy

LibWeb/HTML: Hook up WindowOrWorkerGlobalScopeMixin to Window

This prepares us to use the shared implementations from this class.
Linus Groh před 2 roky
rodič
revize
376fb9ae40

+ 1 - 1
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -1847,7 +1847,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::is_secure_context_getter)
 {
     auto* impl = TRY(impl_from(vm));
     // The isSecureContext getter steps are to return true if this's relevant settings object is a secure context, or false otherwise.
-    return JS::Value(is_secure_context(impl->associated_document().relevant_settings_object()));
+    return JS::Value(HTML::is_secure_context(impl->associated_document().relevant_settings_object()));
 }
 
 JS_DEFINE_NATIVE_FUNCTION(Window::local_storage_getter)

+ 7 - 0
Userland/Libraries/LibWeb/HTML/Window.h

@@ -24,6 +24,7 @@
 #include <LibWeb/HTML/Plugin.h>
 #include <LibWeb/HTML/Scripting/ImportMap.h>
 #include <LibWeb/HTML/WindowEventHandlers.h>
+#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
 
 namespace Web::HTML {
 
@@ -36,6 +37,7 @@ class Window final
     : public DOM::EventTarget
     , public HTML::GlobalEventHandlers
     , public HTML::WindowEventHandlers
+    , public WindowOrWorkerGlobalScopeMixin
     , public Bindings::WindowGlobalMixin {
     WEB_PLATFORM_OBJECT(Window, DOM::EventTarget);
 
@@ -44,8 +46,13 @@ public:
 
     ~Window();
 
+    // ^DOM::EventTarget
     virtual bool dispatch_event(DOM::Event&) override;
 
+    // ^WindowOrWorkerGlobalScopeMixin
+    virtual Bindings::PlatformObject& this_impl() override { return *this; }
+    virtual Bindings::PlatformObject const& this_impl() const override { return *this; }
+
     Page* page();
     Page const* page() const;