/src/serenity/Userland/Libraries/LibWeb/Bindings/Serializable.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2024, Kenneth Myhra <kennethmyhra@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibJS/Runtime/Realm.h> |
10 | | #include <LibWeb/HTML/StructuredSerialize.h> |
11 | | |
12 | | namespace Web::Bindings { |
13 | | |
14 | | // https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects |
15 | | class Serializable { |
16 | | public: |
17 | 0 | virtual ~Serializable() = default; |
18 | | |
19 | | virtual StringView interface_name() const = 0; |
20 | | |
21 | | // https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps |
22 | | virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage, HTML::SerializationMemory&) = 0; |
23 | | // https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps |
24 | | virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position, HTML::DeserializationMemory&) = 0; |
25 | | }; |
26 | | |
27 | | } |