mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibWeb: Make Cookie::Cookie transportable over IPC
This commit is contained in:
parent
1837a5301f
commit
2c808958b9
3 changed files with 51 additions and 0 deletions
|
@ -66,6 +66,7 @@ set(SOURCES
|
||||||
CSS/Supports.cpp
|
CSS/Supports.cpp
|
||||||
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
|
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
|
||||||
CSS/Time.cpp
|
CSS/Time.cpp
|
||||||
|
Cookie/Cookie.cpp
|
||||||
Cookie/ParsedCookie.cpp
|
Cookie/ParsedCookie.cpp
|
||||||
DOM/AbortController.cpp
|
DOM/AbortController.cpp
|
||||||
DOM/AbortSignal.cpp
|
DOM/AbortSignal.cpp
|
||||||
|
|
42
Userland/Libraries/LibWeb/Cookie/Cookie.cpp
Normal file
42
Userland/Libraries/LibWeb/Cookie/Cookie.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Cookie.h"
|
||||||
|
#include <LibIPC/Decoder.h>
|
||||||
|
#include <LibIPC/Encoder.h>
|
||||||
|
|
||||||
|
bool IPC::encode(Encoder& encoder, Web::Cookie::Cookie const& cookie)
|
||||||
|
{
|
||||||
|
encoder << cookie.name;
|
||||||
|
encoder << cookie.value;
|
||||||
|
encoder << cookie.domain;
|
||||||
|
encoder << cookie.path;
|
||||||
|
encoder << cookie.creation_time;
|
||||||
|
encoder << cookie.expiry_time;
|
||||||
|
encoder << cookie.host_only;
|
||||||
|
encoder << cookie.http_only;
|
||||||
|
encoder << cookie.last_access_time;
|
||||||
|
encoder << cookie.persistent;
|
||||||
|
encoder << cookie.secure;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> IPC::decode(Decoder& decoder, Web::Cookie::Cookie& cookie)
|
||||||
|
{
|
||||||
|
TRY(decoder.decode(cookie.name));
|
||||||
|
TRY(decoder.decode(cookie.value));
|
||||||
|
TRY(decoder.decode(cookie.domain));
|
||||||
|
TRY(decoder.decode(cookie.path));
|
||||||
|
TRY(decoder.decode(cookie.creation_time));
|
||||||
|
TRY(decoder.decode(cookie.expiry_time));
|
||||||
|
TRY(decoder.decode(cookie.host_only));
|
||||||
|
TRY(decoder.decode(cookie.http_only));
|
||||||
|
TRY(decoder.decode(cookie.last_access_time));
|
||||||
|
TRY(decoder.decode(cookie.persistent));
|
||||||
|
TRY(decoder.decode(cookie.secure));
|
||||||
|
return {};
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibCore/DateTime.h>
|
#include <LibCore/DateTime.h>
|
||||||
|
#include <LibIPC/Forward.h>
|
||||||
|
|
||||||
namespace Web::Cookie {
|
namespace Web::Cookie {
|
||||||
|
|
||||||
|
@ -31,3 +32,10 @@ struct Cookie {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace IPC {
|
||||||
|
|
||||||
|
bool encode(Encoder&, Web::Cookie::Cookie const&);
|
||||||
|
ErrorOr<void> decode(Decoder&, Web::Cookie::Cookie&);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue