diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index a89ed290d0..3ea3c63635 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -620,7 +620,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex // a boolean noopener are as follows: // 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; @@ -734,7 +734,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex } // 9. Return chosen and windowType. - return { chosen, window_type }; + return { chosen.ptr(), window_type }; } // https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-browsing-context diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h index ffab00398a..3a8c46b768 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -29,15 +30,15 @@ namespace Web::HTML { class BrowsingContext final - : public JS::Cell + : public AbstractBrowsingContext , public Weakable { - JS_CELL(BrowsingContext, JS::Cell); + JS_CELL(BrowsingContext, AbstractBrowsingContext); public: static JS::NonnullGCPtr create_a_new_browsing_context(Page&, JS::GCPtr creator, JS::GCPtr embedder, BrowsingContextGroup&); static JS::NonnullGCPtr create_a_new_top_level_browsing_context(Page&); - ~BrowsingContext(); + virtual ~BrowsingContext() override; JS::GCPtr parent() const { return m_parent; } void append_child(JS::NonnullGCPtr); @@ -121,12 +122,8 @@ public: void set_active_document(JS::NonnullGCPtr); - HTML::WindowProxy* window_proxy(); - HTML::WindowProxy const* window_proxy() const; - - 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 HTML::WindowProxy* window_proxy() override; + virtual HTML::WindowProxy const* window_proxy() const override; HTML::Window* active_window(); HTML::Window const* active_window() const; @@ -170,7 +167,7 @@ public: }; struct ChosenBrowsingContext { - JS::GCPtr browsing_context; + JS::GCPtr browsing_context; WindowType window_type; }; @@ -211,9 +208,6 @@ public: JS::GCPtr currently_focused_area(); - DeprecatedString const& name() const { return m_name; } - void set_name(DeprecatedString const& name) { m_name = name; } - Vector& session_history() { return m_session_history; } Vector const& session_history() const { return m_session_history; } size_t session_history_index() const { return *m_session_history_index; } @@ -231,7 +225,7 @@ public: bool is_allowed_to_navigate(BrowsingContext const&) const; // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate - WebIDL::ExceptionOr navigate( + virtual WebIDL::ExceptionOr navigate( JS::NonnullGCPtr resource, BrowsingContext& source_browsing_context, bool exceptions_enabled = false, @@ -239,7 +233,7 @@ public: Optional history_policy_container = {}, DeprecatedString navigation_type = "other", Optional navigation_id = {}, - Function)> process_response_end_of_body = {}); + Function)> process_response_end_of_body = {}) override; // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid WebIDL::ExceptionOr navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, DeprecatedString navigation_id); @@ -256,8 +250,6 @@ public: VisibilityState system_visibility_state() const; void set_system_visibility_state(VisibilityState); - void set_is_popup(bool is_popup) { m_is_popup = is_popup; } - // https://html.spec.whatwg.org/multipage/window-object.html#a-browsing-context-is-discarded void discard(); bool has_been_discarded() const { return m_has_been_discarded; } @@ -267,8 +259,8 @@ public: Optional const& creator_url() const { return m_creator_url; } - String const& window_handle() const { return m_window_handle; } - void set_window_handle(String handle) { m_window_handle = move(handle); } + virtual String const& window_handle() const override { return m_window_handle; } + virtual void set_window_handle(String handle) override { m_window_handle = move(handle); } private: explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*); @@ -311,9 +303,6 @@ private: // https://html.spec.whatwg.org/multipage/browsers.html#browsing-context JS::GCPtr m_window_proxy; - // https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context - JS::GCPtr m_opener_browsing_context; - DOM::Position m_cursor_position; RefPtr m_cursor_blink_timer; bool m_cursor_blink_state { false }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp index 4e2d9ba63a..190e65812b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp @@ -537,7 +537,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional // FIXME: "navigate" means implementing the navigation algorithm here: // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate hyperlink_element_utils_queue_an_element_task(Task::Source::DOMManipulation, [url_string, target] { - target->loader().load(url_string, FrameLoader::Type::Navigation); + verify_cast(*target).loader().load(url_string, FrameLoader::Type::Navigation); }); }