diff options
author | Rafał Babiarz <5783815+Sauler@users.noreply.github.com> | 2022-03-01 17:05:42 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-02 18:11:17 +0100 |
commit | 5f5ee2020e4a58d01b4bc47f3dfdc6ba44dda75b (patch) | |
tree | 27f9ddbf9f55ba4cd1295fab35b4beaf06b792ea /Userland/Applications/Browser/CookieJar.cpp | |
parent | 81c042a8cd1596b6fb767bcf2bc507a3bceacd41 (diff) | |
download | serenity-5f5ee2020e4a58d01b4bc47f3dfdc6ba44dda75b.zip |
Browser: Add method to get cookies list
Diffstat (limited to 'Userland/Applications/Browser/CookieJar.cpp')
-rw-r--r-- | Userland/Applications/Browser/CookieJar.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp index cb65e7963d..119dc9e1ab 100644 --- a/Userland/Applications/Browser/CookieJar.cpp +++ b/Userland/Applications/Browser/CookieJar.cpp @@ -75,6 +75,17 @@ void CookieJar::dump_cookies() const dbgln("{}", builder.build()); } +Vector<Web::Cookie::Cookie> CookieJar::get_all_cookies() const +{ + Vector<Web::Cookie::Cookie> cookies; + cookies.ensure_capacity(m_cookies.size()); + + for (auto const& cookie : m_cookies) + cookies.unchecked_append(cookie.value); + + return cookies; +} + Optional<String> CookieJar::canonicalize_domain(const URL& url) { // https://tools.ietf.org/html/rfc6265#section-5.1.2 |