1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:37:45 +00:00

Ladybird/WebDriver: Implement the cookie endpoints for Ladybird

This commit is contained in:
Timothy Flynn 2022-11-14 17:23:35 -05:00 committed by Andrew Kaster
parent 9e0db602ca
commit 948c4ba102
3 changed files with 24 additions and 3 deletions

View file

@ -297,6 +297,14 @@ void BrowserWindow::new_tab()
QObject::connect(tab_ptr, &Tab::title_changed, this, &BrowserWindow::tab_title_changed);
QObject::connect(tab_ptr, &Tab::favicon_changed, this, &BrowserWindow::tab_favicon_changed);
tab_ptr->view().on_get_all_cookies = [this](auto const& url) {
return m_cookie_jar.get_all_cookies(url);
};
tab_ptr->view().on_get_named_cookie = [this](auto const& url, auto const& name) {
return m_cookie_jar.get_named_cookie(url, name);
};
tab_ptr->view().on_get_cookie = [this](auto& url, auto source) -> String {
return m_cookie_jar.get_cookie(url, source);
};
@ -305,6 +313,10 @@ void BrowserWindow::new_tab()
m_cookie_jar.set_cookie(url, cookie, source);
};
tab_ptr->view().on_update_cookie = [this](auto const& url, auto const& cookie) {
m_cookie_jar.update_cookie(url, cookie);
};
tab_ptr->focus_location_editor();
}