diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp index 8f4b7e058e..6d0d0d4940 100644 --- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp +++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp @@ -25,7 +25,10 @@ */ #include "ParsedCookie.h" +#include <AK/StdLibExtras.h> #include <AK/Vector.h> +#include <LibIPC/Decoder.h> +#include <LibIPC/Encoder.h> #include <ctype.h> namespace Web::Cookie { @@ -351,3 +354,39 @@ Optional<Core::DateTime> parse_date_time(StringView date_string) } } + +bool IPC::encode(IPC::Encoder& encoder, const Web::Cookie::ParsedCookie& cookie) +{ + encoder << cookie.name; + encoder << cookie.value; + encoder << cookie.expiry_time_from_expires_attribute; + encoder << cookie.expiry_time_from_max_age_attribute; + encoder << cookie.domain; + encoder << cookie.path; + encoder << cookie.secure_attribute_present; + encoder << cookie.http_only_attribute_present; + + return true; +} + +bool IPC::decode(IPC::Decoder& decoder, Web::Cookie::ParsedCookie& cookie) +{ + if (!decoder.decode(cookie.name)) + return false; + if (!decoder.decode(cookie.value)) + return false; + if (!decoder.decode(cookie.expiry_time_from_expires_attribute)) + return false; + if (!decoder.decode(cookie.expiry_time_from_max_age_attribute)) + return false; + if (!decoder.decode(cookie.domain)) + return false; + if (!decoder.decode(cookie.path)) + return false; + if (!decoder.decode(cookie.secure_attribute_present)) + return false; + if (!decoder.decode(cookie.http_only_attribute_present)) + return false; + + return true; +} |