mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00:00
Userland: Remove remaining users of Duration::now_realtime()
This is a clear sign that they want to use a UnixDateTime instead. This also adds support for placing durations and date times into SQL databases via their millisecond offset to UTC.
This commit is contained in:
parent
82c681e44b
commit
effcd080ca
Notes:
sideshowbarker
2024-07-17 01:23:08 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: effcd080ca
Pull-request: https://github.com/SerenityOS/serenity/pull/17842
Reviewed-by: https://github.com/me-minus
Reviewed-by: https://github.com/timschumi
16 changed files with 62 additions and 45 deletions
|
@ -56,7 +56,7 @@ static JsonValue serialize_cookie(Web::Cookie::Cookie const& cookie)
|
|||
serialized_cookie.set("domain"sv, cookie.domain);
|
||||
serialized_cookie.set("secure"sv, cookie.secure);
|
||||
serialized_cookie.set("httpOnly"sv, cookie.http_only);
|
||||
serialized_cookie.set("expiry"sv, cookie.expiry_time.to_seconds());
|
||||
serialized_cookie.set("expiry"sv, cookie.expiry_time.seconds_since_epoch());
|
||||
serialized_cookie.set("sameSite"sv, Web::Cookie::same_site_to_string(cookie.same_site));
|
||||
|
||||
return serialized_cookie;
|
||||
|
@ -1602,7 +1602,7 @@ Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(Jso
|
|||
if (data.has("expiry"sv)) {
|
||||
// NOTE: less than 0 or greater than safe integer are handled by the JSON parser
|
||||
auto expiry = TRY(get_property<u32>(data, "expiry"sv));
|
||||
cookie.expiry_time_from_expires_attribute = Duration::from_seconds(expiry);
|
||||
cookie.expiry_time_from_expires_attribute = UnixDateTime::from_seconds_since_epoch(expiry);
|
||||
}
|
||||
|
||||
// Cookie same site
|
||||
|
@ -2039,7 +2039,7 @@ void WebDriverConnection::delete_cookies(Optional<StringView> const& name)
|
|||
// -> name is equal to cookie name
|
||||
if (!name.has_value() || name.value() == cookie.name) {
|
||||
// Set the cookie expiry time to a Unix timestamp in the past.
|
||||
cookie.expiry_time = Duration::from_seconds(0);
|
||||
cookie.expiry_time = UnixDateTime::earliest();
|
||||
m_page_client.page_did_update_cookie(move(cookie));
|
||||
}
|
||||
// -> Otherwise
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue