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

Browser: Remove some needless indirection from Cookie-related IPCs

We don't need to forward Cookie-related IPCs from the WebView through
the Tab to the BrowserWindow. We can skip the Tab like we do in other
chromes.

This is primarily to reduce overhead when changing Cookie IPCs in future
patches.
This commit is contained in:
Timothy Flynn 2024-01-26 11:06:23 -05:00 committed by Andreas Kling
parent 8ea4e37c27
commit dcd9962d7b
3 changed files with 9 additions and 49 deletions

View file

@ -361,9 +361,7 @@ void BrowserWindow::build_menus(StringView const man_file)
active_tab().m_history.dump();
}));
debug_menu->add_action(GUI::Action::create("Dump C&ookies", g_icon_bag.cookie, [this](auto&) {
auto& tab = active_tab();
if (tab.on_dump_cookies)
tab.on_dump_cookies();
m_cookie_jar.dump_cookies();
}));
debug_menu->add_action(GUI::Action::create("Dump Loc&al Storage", g_icon_bag.local_storage, [this](auto&) {
active_tab().view().debug_request("dump-local-storage");
@ -578,28 +576,24 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
create_new_window(url);
};
new_tab.on_get_all_cookies = [this](auto& url) {
new_tab.view().on_get_all_cookies = [this](auto& url) {
return m_cookie_jar.get_all_cookies(url);
};
new_tab.on_get_named_cookie = [this](auto& url, auto& name) {
new_tab.view().on_get_named_cookie = [this](auto& url, auto& name) {
return m_cookie_jar.get_named_cookie(url, name);
};
new_tab.on_get_cookie = [this](auto& url, auto source) -> ByteString {
new_tab.view().on_get_cookie = [this](auto& url, auto source) {
return m_cookie_jar.get_cookie(url, source);
};
new_tab.on_set_cookie = [this](auto& url, auto& cookie, auto source) {
new_tab.view().on_set_cookie = [this](auto& url, auto& cookie, auto source) {
m_cookie_jar.set_cookie(url, cookie, source);
};
new_tab.on_dump_cookies = [this]() {
m_cookie_jar.dump_cookies();
};
new_tab.on_update_cookie = [this](auto cookie) {
m_cookie_jar.update_cookie(move(cookie));
new_tab.view().on_update_cookie = [this](auto const& cookie) {
m_cookie_jar.update_cookie(cookie);
};
new_tab.on_get_cookies_entries = [this]() {