mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
Browser: Add method to get cookies list
This commit is contained in:
parent
81c042a8cd
commit
5f5ee2020e
Notes:
sideshowbarker
2024-07-17 18:02:45 +09:00
Author: https://github.com/Sauler
Commit: 5f5ee2020e
Pull-request: https://github.com/SerenityOS/serenity/pull/12832
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/trflynn89
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
String get_cookie(const URL& url, Web::Cookie::Source source);
|
||||
void set_cookie(const URL& url, const Web::Cookie::ParsedCookie& parsed_cookie, Web::Cookie::Source source);
|
||||
void dump_cookies() const;
|
||||
Vector<Web::Cookie::Cookie> get_all_cookies() const;
|
||||
|
||||
private:
|
||||
static Optional<String> canonicalize_domain(const URL& url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue