1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Browser: Show SameSite attribute in cookie storage inspector

This commit is contained in:
Smrtnyk 2022-10-21 13:01:06 +02:00 committed by Linus Groh
parent b08ae57b23
commit cb480fa3dc
3 changed files with 7 additions and 1 deletions

View file

@ -99,6 +99,7 @@ void CookieJar::dump_cookies() const
builder.appendff("\t{}HttpOnly{} = {:s}\n", attribute_color, no_color, cookie.value.http_only);
builder.appendff("\t{}HostOnly{} = {:s}\n", attribute_color, no_color, cookie.value.host_only);
builder.appendff("\t{}Persistent{} = {:s}\n", attribute_color, no_color, cookie.value.persistent);
builder.appendff("\t{}SameSite{} = {:s}\n", attribute_color, no_color, Web::Cookie::same_site_to_string(cookie.value.same_site));
}
dbgln("{}", builder.build());
@ -199,7 +200,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
// https://tools.ietf.org/html/rfc6265#section-5.3
// 2. Create a new cookie with name cookie-name, value cookie-value. Set the creation-time and the last-access-time to the current date and time.
Web::Cookie::Cookie cookie { parsed_cookie.name, parsed_cookie.value };
Web::Cookie::Cookie cookie { parsed_cookie.name, parsed_cookie.value, parsed_cookie.same_site_attribute };
cookie.creation_time = Core::DateTime::now();
cookie.last_access_time = cookie.creation_time;

View file

@ -47,6 +47,8 @@ String CookiesModel::column_name(int column) const
return "Value";
case Column::ExpiryTime:
return "Expiry time";
case Column::SameSite:
return "SameSite";
case Column::__Count:
return {};
}
@ -79,6 +81,8 @@ GUI::Variant CookiesModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
return cookie.value;
case Column::ExpiryTime:
return cookie.expiry_time.to_string();
case Column::SameSite:
return Web::Cookie::same_site_to_string(cookie.same_site);
}
VERIFY_NOT_REACHED();

View file

@ -22,6 +22,7 @@ public:
Name,
Value,
ExpiryTime,
SameSite,
__Count,
};