Skip to content

Commit

Permalink
Browser: Add update_cookie WebDriver IPC endpoint
Browse files Browse the repository at this point in the history
Through this the WebDriver will be able to change cookies. Needed for
deleting cookies.
  • Loading branch information
TobyAsE authored and linusg committed Oct 17, 2022
1 parent 3036091 commit c710780
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Userland/Applications/Browser/WebDriverConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,14 @@ Messages::WebDriverSessionClient::GetNamedCookieResponse WebDriverConnection::ge
return { {} };
}

void WebDriverConnection::update_cookie(Web::Cookie::Cookie const& cookie)
{
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.on_update_cookie) {
tab.on_update_cookie(tab.url(), cookie);
}
}
}

}
1 change: 1 addition & 0 deletions Userland/Applications/Browser/WebDriverConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class WebDriverConnection final
virtual void forward() override;
virtual Messages::WebDriverSessionClient::GetAllCookiesResponse get_all_cookies() override;
virtual Messages::WebDriverSessionClient::GetNamedCookieResponse get_named_cookie(String const& name) override;
virtual void update_cookie(Web::Cookie::Cookie const&) override;

private:
WebDriverConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, NonnullRefPtr<BrowserWindow> browser_window);
Expand Down
1 change: 1 addition & 0 deletions Userland/Applications/Browser/WebDriverSessionClient.ipc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ endpoint WebDriverSessionClient {
forward() =|
get_all_cookies() => (Vector<Web::Cookie::Cookie> cookies)
get_named_cookie(String name) => (Optional<Web::Cookie::Cookie> cookie)
update_cookie(Web::Cookie::Cookie cookie) =|

}

0 comments on commit c710780

Please sign in to comment.