diff --git a/Userland/Libraries/LibWeb/Bindings/Serializable.h b/Userland/Libraries/LibWeb/Bindings/Serializable.h new file mode 100644 index 0000000000..0cc8570987 --- /dev/null +++ b/Userland/Libraries/LibWeb/Bindings/Serializable.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024, Kenneth Myhra + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::Bindings { + +// https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects +class Serializable { +public: + virtual ~Serializable() = default; + + virtual StringView interface_name() const = 0; + + // https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps + virtual WebIDL::ExceptionOr serialization_steps(HTML::SerializationRecord&, bool for_storage) = 0; + // https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps + virtual WebIDL::ExceptionOr deserialization_steps(ReadonlySpan const&, size_t& position) = 0; +}; + +}