Ladybird: Hook up the CookieJar again after WebContent introduction

This commit is contained in:
Andreas Kling 2022-10-11 10:53:28 +02:00 committed by Andrew Kaster
parent 775332e179
commit 71dadabfaa
Notes: sideshowbarker 2024-07-17 06:35:16 +09:00
2 changed files with 12 additions and 1 deletions

View file

@ -159,7 +159,7 @@ BrowserWindow::BrowserWindow()
dump_cookies_action->setIcon(QIcon(QString("%1/res/icons/browser/cookie.png").arg(s_serenity_resource_root.characters())));
debug_menu->addAction(dump_cookies_action);
QObject::connect(dump_cookies_action, &QAction::triggered, this, [this] {
debug_request("dump-cookies");
m_cookie_jar.dump_cookies();
});
auto* dump_local_storage_action = new QAction("Dump Local Storage", this);
@ -295,6 +295,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_cookie = [this](auto& url, auto source) -> String {
return m_cookie_jar.get_cookie(url, source);
};
tab_ptr->view().on_set_cookie = [this](auto& url, auto& cookie, auto source) {
m_cookie_jar.set_cookie(url, cookie, source);
};
tab_ptr->focus_location_editor();
}

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "CookieJar.h"
#include "Tab.h"
#include <AK/NonnullOwnPtrVector.h>
#include <LibCore/Forward.h>
@ -45,4 +46,6 @@ private:
QTabWidget* m_tabs_container { nullptr };
NonnullOwnPtrVector<Tab> m_tabs;
Tab* m_current_tab { nullptr };
Browser::CookieJar m_cookie_jar;
};