mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
WebContent: Add a JS visitor to WebDriver's IPC connection
We've added a few JS::Handle members to this class over time. Let's avoid creating a new GC root for each of these, and explicitly add a visitation method. (cherry picked from commit 048b51eb54d003af5dc202af1b16bb690b1348f9)
This commit is contained in:
1 parent
2d24c5fbf8
commit
d8080cf1a6
3 files changed
+19
-6
No files matched your search
@@ -112,6 +112,9 @@ void PageClient::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_page);
|
||||
|
||||
if (m_webdriver)
|
||||
m_webdriver->visit_edges(visitor);
|
||||
}
|
||||
|
||||
ConnectionFromClient& PageClient::client() const
|
||||
|
||||
@@ -200,6 +200,14 @@ WebDriverConnection::WebDriverConnection(NonnullOwnPtr<Core::LocalSocket> socket
|
||||
set_current_top_level_browsing_context(page_client.page().top_level_browsing_context());
|
||||
}
|
||||
|
||||
void WebDriverConnection::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(m_current_browsing_context);
|
||||
visitor.visit(m_current_parent_browsing_context);
|
||||
visitor.visit(m_current_top_level_browsing_context);
|
||||
visitor.visit(m_action_executor);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-close-the-session
|
||||
void WebDriverConnection::close_session()
|
||||
{
|
||||
|
||||
@@ -34,6 +34,8 @@ public:
|
||||
static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, ByteString const& webdriver_ipc_path);
|
||||
virtual ~WebDriverConnection() = default;
|
||||
|
||||
void visit_edges(JS::Cell::Visitor&);
|
||||
|
||||
private:
|
||||
WebDriverConnection(NonnullOwnPtr<Core::LocalSocket> socket, Web::PageClient& page_client);
|
||||
|
||||
@@ -106,10 +108,10 @@ private:
|
||||
|
||||
void set_current_browsing_context(Web::HTML::BrowsingContext&);
|
||||
Web::HTML::BrowsingContext& current_browsing_context() { return *m_current_browsing_context; }
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> current_parent_browsing_context() { return m_current_parent_browsing_context.ptr(); }
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> current_parent_browsing_context() { return m_current_parent_browsing_context; }
|
||||
|
||||
void set_current_top_level_browsing_context(Web::HTML::BrowsingContext&);
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> current_top_level_browsing_context() { return m_current_top_level_browsing_context.ptr(); }
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> current_top_level_browsing_context() { return m_current_top_level_browsing_context; }
|
||||
|
||||
ErrorOr<void, Web::WebDriver::Error> ensure_current_browsing_context_is_open();
|
||||
ErrorOr<void, Web::WebDriver::Error> ensure_current_top_level_browsing_context_is_open();
|
||||
@@ -147,15 +149,15 @@ private:
|
||||
Web::WebDriver::TimeoutsConfiguration m_timeouts_configuration;
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-current-browsing-context
|
||||
JS::Handle<Web::HTML::BrowsingContext> m_current_browsing_context;
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> m_current_browsing_context;
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-current-parent-browsing-context
|
||||
JS::Handle<Web::HTML::BrowsingContext> m_current_parent_browsing_context;
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> m_current_parent_browsing_context;
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-current-top-level-browsing-context
|
||||
JS::Handle<Web::HTML::BrowsingContext> m_current_top_level_browsing_context;
|
||||
JS::GCPtr<Web::HTML::BrowsingContext> m_current_top_level_browsing_context;
|
||||
|
||||
JS::Handle<JS::Cell> m_action_executor;
|
||||
JS::GCPtr<JS::Cell> m_action_executor;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user