mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:47:46 +00:00
LibWeb: Port Cookie from DeprecatedString to String
This commit is contained in:
parent
e3bc8610a9
commit
e28fb5c64c
4 changed files with 51 additions and 51 deletions
|
@ -12,24 +12,24 @@
|
|||
|
||||
namespace Web::Cookie {
|
||||
|
||||
static DeprecatedString time_to_string(UnixDateTime const& time)
|
||||
static String time_to_string(UnixDateTime const& time)
|
||||
{
|
||||
// FIXME: This roundabout formatting should not be necessary; it also loses precision.
|
||||
auto local_time = Core::DateTime::from_timestamp(time.seconds_since_epoch());
|
||||
return local_time.to_deprecated_string("%Y-%m-%d %H:%M:%S %Z"sv);
|
||||
return MUST(local_time.to_string("%Y-%m-%d %H:%M:%S %Z"sv));
|
||||
}
|
||||
|
||||
DeprecatedString Cookie::creation_time_to_string() const
|
||||
String Cookie::creation_time_to_string() const
|
||||
{
|
||||
return time_to_string(creation_time);
|
||||
}
|
||||
|
||||
DeprecatedString Cookie::last_access_time_to_string() const
|
||||
String Cookie::last_access_time_to_string() const
|
||||
{
|
||||
return time_to_string(last_access_time);
|
||||
}
|
||||
|
||||
DeprecatedString Cookie::expiry_time_to_string() const
|
||||
String Cookie::expiry_time_to_string() const
|
||||
{
|
||||
return time_to_string(expiry_time);
|
||||
}
|
||||
|
@ -84,10 +84,10 @@ ErrorOr<void> IPC::encode(Encoder& encoder, Web::Cookie::Cookie const& cookie)
|
|||
template<>
|
||||
ErrorOr<Web::Cookie::Cookie> IPC::decode(Decoder& decoder)
|
||||
{
|
||||
auto name = TRY(decoder.decode<DeprecatedString>());
|
||||
auto value = TRY(decoder.decode<DeprecatedString>());
|
||||
auto domain = TRY(decoder.decode<DeprecatedString>());
|
||||
auto path = TRY(decoder.decode<DeprecatedString>());
|
||||
auto name = TRY(decoder.decode<String>());
|
||||
auto value = TRY(decoder.decode<String>());
|
||||
auto domain = TRY(decoder.decode<String>());
|
||||
auto path = TRY(decoder.decode<String>());
|
||||
auto creation_time = TRY(decoder.decode<UnixDateTime>());
|
||||
auto expiry_time = TRY(decoder.decode<UnixDateTime>());
|
||||
auto host_only = TRY(decoder.decode<bool>());
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Time.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
|
||||
|
@ -25,18 +25,18 @@ enum class Source {
|
|||
};
|
||||
|
||||
struct Cookie {
|
||||
DeprecatedString creation_time_to_string() const;
|
||||
DeprecatedString last_access_time_to_string() const;
|
||||
DeprecatedString expiry_time_to_string() const;
|
||||
String creation_time_to_string() const;
|
||||
String last_access_time_to_string() const;
|
||||
String expiry_time_to_string() const;
|
||||
|
||||
DeprecatedString name;
|
||||
DeprecatedString value;
|
||||
String name;
|
||||
String value;
|
||||
SameSite same_site;
|
||||
UnixDateTime creation_time {};
|
||||
UnixDateTime last_access_time {};
|
||||
UnixDateTime expiry_time {};
|
||||
DeprecatedString domain {};
|
||||
DeprecatedString path {};
|
||||
String domain {};
|
||||
String path {};
|
||||
bool secure { false };
|
||||
bool http_only { false };
|
||||
bool host_only { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue