1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

Browser+LibWeb: Add hooks for getting and setting cookies

This commit is contained in:
Timothy Flynn 2021-04-11 10:53:15 -04:00 committed by Andreas Kling
parent f0cdb2bf50
commit e54837add5
4 changed files with 26 additions and 0 deletions

View file

@ -242,6 +242,17 @@ Tab::Tab(Type type)
on_favicon_change(icon);
};
hooks().on_get_cookie = [this](auto& url) -> String {
if (on_get_cookie)
return on_get_cookie(url);
return {};
};
hooks().on_set_cookie = [this](auto& url, auto& cookie) {
if (on_set_cookie)
on_set_cookie(url, cookie);
};
hooks().on_get_source = [this](auto& url, auto& source) {
view_source(url, source);
};