diff --git a/Meta/gn/secondary/Userland/Libraries/LibWeb/HTML/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibWeb/HTML/BUILD.gn index 057aaf0a67..920adbabcf 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/HTML/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/HTML/BUILD.gn @@ -11,7 +11,6 @@ source_set("HTML") { "//Userland/Libraries/LibWeb:all_generated", ] sources = [ - "AbstractBrowsingContext.cpp", "AnimatedBitmapDecodedImageData.cpp", "AttributeNames.cpp", "AudioTrack.cpp", @@ -140,7 +139,6 @@ source_set("HTML") { "PluginArray.cpp", "PotentialCORSRequest.cpp", "PromiseRejectionEvent.cpp", - "RemoteBrowsingContext.cpp", "SelectItem.cpp", "SessionHistoryEntry.cpp", "SharedImageRequest.cpp", diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 6b39de94d5..fc47079532 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -226,7 +226,6 @@ set(SOURCES Geometry/DOMRect.cpp Geometry/DOMRectList.cpp Geometry/DOMRectReadOnly.cpp - HTML/AbstractBrowsingContext.cpp HTML/AnimatedBitmapDecodedImageData.cpp HTML/AttributeNames.cpp HTML/AudioTrack.cpp @@ -374,7 +373,6 @@ set(SOURCES HTML/PluginArray.cpp HTML/PotentialCORSRequest.cpp HTML/PromiseRejectionEvent.cpp - HTML/RemoteBrowsingContext.cpp HTML/Scripting/ClassicScript.cpp HTML/Scripting/Environments.cpp HTML/Scripting/ExceptionReporter.cpp diff --git a/Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.cpp deleted file mode 100644 index 09bfa10592..0000000000 --- a/Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2023, Tim Flynn - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include - -namespace Web::HTML { - -void AbstractBrowsingContext::visit_edges(JS::Cell::Visitor& visitor) -{ - Base::visit_edges(visitor); - visitor.visit(m_opener_browsing_context); -} - -} diff --git a/Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.h b/Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.h deleted file mode 100644 index 29b9f3ccfa..0000000000 --- a/Userland/Libraries/LibWeb/HTML/AbstractBrowsingContext.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023, Aliaksandr Kalenik - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace Web::HTML { - -class AbstractBrowsingContext : public JS::Cell { - JS_CELL(AbstractBrowsingContext, Cell); - -public: - virtual HTML::WindowProxy* window_proxy() = 0; - virtual HTML::WindowProxy const* window_proxy() const = 0; - - String const& name() const { return m_name; } - void set_name(String const& name) { m_name = name; } - - JS::GCPtr opener_browsing_context() const { return m_opener_browsing_context; } - void set_opener_browsing_context(JS::GCPtr browsing_context) { m_opener_browsing_context = browsing_context; } - - void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; } - - virtual String const& window_handle() const = 0; - virtual void set_window_handle(String handle) = 0; - -protected: - virtual void visit_edges(JS::Cell::Visitor&) override; - - String m_name; - - // https://html.spec.whatwg.org/multipage/browsers.html#is-popup - TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No }; - - // https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context - JS::GCPtr m_opener_browsing_context; -}; - -} diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 1d2650c99b..6a589edf8d 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -10,17 +10,14 @@ #include #include #include -#include #include #include #include #include -#include #include #include #include #include -#include #include #include #include @@ -29,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -515,7 +511,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex { // The rules for choosing a browsing context, given a browsing context name name, a browsing context current, and // a boolean noopener are as follows: - JS::GCPtr matching_name_in_tree = nullptr; + JS::GCPtr matching_name_in_tree = nullptr; top_level_browsing_context()->for_each_in_subtree([&](auto& context) { if (context.name() == name) { matching_name_in_tree = &context; @@ -526,7 +522,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex }); // 1. Let chosen be null. - JS::GCPtr chosen = nullptr; + JS::GCPtr chosen = nullptr; // 2. Let windowType be "existing or none". auto window_type = WindowType::ExistingOrNone; diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h index 5e96971028..adffcc6948 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -31,10 +30,9 @@ namespace Web::HTML { -class BrowsingContext final - : public AbstractBrowsingContext +class BrowsingContext final : public JS::Cell , public Weakable { - JS_CELL(BrowsingContext, AbstractBrowsingContext); + JS_CELL(BrowsingContext, JS::Cell); JS_DECLARE_ALLOCATOR(BrowsingContext); public: @@ -107,8 +105,8 @@ public: DOM::Document const* active_document() const; DOM::Document* active_document(); - virtual HTML::WindowProxy* window_proxy() override; - virtual HTML::WindowProxy const* window_proxy() const override; + HTML::WindowProxy* window_proxy(); + HTML::WindowProxy const* window_proxy() const; void set_window_proxy(JS::GCPtr); @@ -130,7 +128,7 @@ public: }; struct ChosenBrowsingContext { - JS::GCPtr browsing_context; + JS::GCPtr browsing_context; WindowType window_type; }; @@ -175,10 +173,13 @@ public: bool has_been_discarded() const { return m_has_been_discarded; } - Optional const& creator_url() const { return m_creator_url; } + JS::GCPtr opener_browsing_context() const { return m_opener_browsing_context; } + void set_opener_browsing_context(JS::GCPtr browsing_context) { m_opener_browsing_context = browsing_context; } - virtual String const& window_handle() const override { return m_window_handle; } - virtual void set_window_handle(String handle) override { m_window_handle = move(handle); } + void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; } + + String const& name() const { return m_name; } + void set_name(String name) { m_name = move(name); } private: explicit BrowsingContext(JS::NonnullGCPtr, HTML::NavigableContainer*); @@ -216,6 +217,14 @@ private: // https://html.spec.whatwg.org/multipage/browsers.html#browsing-context JS::GCPtr m_window_proxy; + // https://html.spec.whatwg.org/multipage/browsers.html#is-popup + TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No }; + + // https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context + JS::GCPtr m_opener_browsing_context; + + String m_name; + JS::GCPtr m_cursor_position; RefPtr m_cursor_blink_timer; bool m_cursor_blink_state { false }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h index 736e3b0890..e8b719038f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h @@ -10,7 +10,6 @@ #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp index b2bae8ebcd..72193ec832 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp deleted file mode 100644 index fc9058124c..0000000000 --- a/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2023, Aliaksandr Kalenik - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include - -namespace Web::HTML { - -JS_DEFINE_ALLOCATOR(RemoteBrowsingContext); - -JS::NonnullGCPtr RemoteBrowsingContext::create_a_new_remote_browsing_context(String handle) -{ - auto browsing_context = Bindings::main_thread_vm().heap().allocate_without_realm(handle); - return browsing_context; -} - -HTML::WindowProxy* RemoteBrowsingContext::window_proxy() -{ - return nullptr; -} - -HTML::WindowProxy const* RemoteBrowsingContext::window_proxy() const -{ - return nullptr; -} - -RemoteBrowsingContext::RemoteBrowsingContext(String handle) - : m_window_handle(handle) {}; - -} diff --git a/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h b/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h deleted file mode 100644 index f1872fe912..0000000000 --- a/Userland/Libraries/LibWeb/HTML/RemoteBrowsingContext.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2023, Aliaksandr Kalenik - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace Web::HTML { - -class RemoteBrowsingContext final - : public AbstractBrowsingContext - , public Weakable { - JS_CELL(RemoteBrowsingContext, AbstractBrowsingContext); - JS_DECLARE_ALLOCATOR(RemoteBrowsingContext); - -public: - static JS::NonnullGCPtr create_a_new_remote_browsing_context(String handle); - - virtual HTML::WindowProxy* window_proxy() override; - virtual HTML::WindowProxy const* window_proxy() const override; - - virtual String const& window_handle() const override { return m_window_handle; } - virtual void set_window_handle(String handle) override { m_window_handle = handle; } - -private: - explicit RemoteBrowsingContext(String); - - String m_window_handle; -}; - -} diff --git a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp index 51e2ce1c7e..da8805aabc 100644 --- a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp +++ b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include