mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:27:34 +00:00
LibWeb: Make Document::set_cookie take a StringView
Enabled by also making the same change to ParsedCookie::parse_cookie :^)
This commit is contained in:
parent
642802d339
commit
8ad05fff4a
4 changed files with 4 additions and 4 deletions
|
@ -29,7 +29,7 @@ static void on_http_only_attribute(ParsedCookie& parsed_cookie);
|
||||||
static void on_same_site_attribute(ParsedCookie& parsed_cookie, StringView attribute_value);
|
static void on_same_site_attribute(ParsedCookie& parsed_cookie, StringView attribute_value);
|
||||||
static Optional<UnixDateTime> parse_date_time(StringView date_string);
|
static Optional<UnixDateTime> parse_date_time(StringView date_string);
|
||||||
|
|
||||||
Optional<ParsedCookie> parse_cookie(DeprecatedString const& cookie_string)
|
Optional<ParsedCookie> parse_cookie(StringView cookie_string)
|
||||||
{
|
{
|
||||||
// https://tools.ietf.org/html/rfc6265#section-5.2
|
// https://tools.ietf.org/html/rfc6265#section-5.2
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct ParsedCookie {
|
||||||
bool http_only_attribute_present { false };
|
bool http_only_attribute_present { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
Optional<ParsedCookie> parse_cookie(DeprecatedString const& cookie_string);
|
Optional<ParsedCookie> parse_cookie(StringView cookie_string);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1967,7 +1967,7 @@ DeprecatedString Document::cookie(Cookie::Source source)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::set_cookie(DeprecatedString const& cookie_string, Cookie::Source source)
|
void Document::set_cookie(StringView cookie_string, Cookie::Source source)
|
||||||
{
|
{
|
||||||
auto cookie = Cookie::parse_cookie(cookie_string);
|
auto cookie = Cookie::parse_cookie(cookie_string);
|
||||||
if (!cookie.has_value())
|
if (!cookie.has_value())
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
JS::GCPtr<Selection::Selection> get_selection() const;
|
JS::GCPtr<Selection::Selection> get_selection() const;
|
||||||
|
|
||||||
DeprecatedString cookie(Cookie::Source = Cookie::Source::NonHttp);
|
DeprecatedString cookie(Cookie::Source = Cookie::Source::NonHttp);
|
||||||
void set_cookie(DeprecatedString const&, Cookie::Source = Cookie::Source::NonHttp);
|
void set_cookie(StringView, Cookie::Source = Cookie::Source::NonHttp);
|
||||||
|
|
||||||
DeprecatedString referrer() const;
|
DeprecatedString referrer() const;
|
||||||
void set_referrer(DeprecatedString);
|
void set_referrer(DeprecatedString);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue