LibWeb: Add SerializationMemory parameter to serialization_steps()

We want to bring with us the value of SerializationMemory to
Serializable::serialization_steps() when doing sub serialization.
This commit is contained in:
Kenneth Myhra 2024-03-10 19:13:45 +01:00 committed by Andreas Kling
parent 924423c596
commit 4669c1ba31
Notes: sideshowbarker 2024-07-16 22:14:49 +09:00
12 changed files with 12 additions and 12 deletions

View File

@ -19,7 +19,7 @@ public:
virtual StringView interface_name() const = 0;
// https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage) = 0;
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage, HTML::SerializationMemory&) = 0;
// https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position) = 0;
};

View File

@ -149,7 +149,7 @@ void Blob::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(Blob);
}
WebIDL::ExceptionOr<void> Blob::serialization_steps(HTML::SerializationRecord& record, bool)
WebIDL::ExceptionOr<void> Blob::serialization_steps(HTML::SerializationRecord& record, bool, HTML::SerializationMemory&)
{
auto& vm = this->vm();

View File

@ -57,7 +57,7 @@ public:
virtual StringView interface_name() const override { return "Blob"sv; }
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord& record, bool for_storage) override;
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord& record, bool for_storage, HTML::SerializationMemory&) override;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const& record, size_t& position) override;
protected:

View File

@ -87,7 +87,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<File>> File::construct_impl(JS::Realm& real
return create(realm, file_bits, file_name, options);
}
WebIDL::ExceptionOr<void> File::serialization_steps(HTML::SerializationRecord& record, bool)
WebIDL::ExceptionOr<void> File::serialization_steps(HTML::SerializationRecord& record, bool, HTML::SerializationMemory&)
{
auto& vm = this->vm();

View File

@ -32,7 +32,7 @@ public:
virtual StringView interface_name() const override { return "File"sv; }
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord& record, bool for_storage) override;
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord& record, bool for_storage, HTML::SerializationMemory&) override;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position) override;
private:

View File

@ -698,7 +698,7 @@ WebIDL::ExceptionOr<String> DOMMatrixReadOnly::to_string() const
}
// https://drafts.fxtf.org/geometry/#structured-serialization
WebIDL::ExceptionOr<void> DOMMatrixReadOnly::serialization_steps(HTML::SerializationRecord& serialized, bool)
WebIDL::ExceptionOr<void> DOMMatrixReadOnly::serialization_steps(HTML::SerializationRecord& serialized, bool, HTML::SerializationMemory&)
{
HTML::serialize_primitive_type(serialized, m_is_2d);
// 1. If values is 2D is true:

View File

@ -115,7 +115,7 @@ public:
WebIDL::ExceptionOr<String> to_string() const;
virtual StringView interface_name() const override { return "DOMMatrixReadOnly"sv; }
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage) override;
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage, HTML::SerializationMemory&) override;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const& record, size_t& position) override;
protected:

View File

@ -65,7 +65,7 @@ void DOMPointReadOnly::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMPointReadOnly);
}
WebIDL::ExceptionOr<void> DOMPointReadOnly::serialization_steps(HTML::SerializationRecord& serialized, bool)
WebIDL::ExceptionOr<void> DOMPointReadOnly::serialization_steps(HTML::SerializationRecord& serialized, bool, HTML::SerializationMemory&)
{
// 1. Set serialized.[[X]] to values x coordinate.
HTML::serialize_primitive_type(serialized, m_x);

View File

@ -45,7 +45,7 @@ public:
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> matrix_transform(DOMMatrixInit&) const;
virtual StringView interface_name() const override { return "DOMPointReadOnly"sv; }
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage) override;
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage, HTML::SerializationMemory&) override;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position) override;
protected:

View File

@ -51,7 +51,7 @@ void DOMRectReadOnly::initialize(JS::Realm& realm)
}
// https://drafts.fxtf.org/geometry/#structured-serialization
WebIDL::ExceptionOr<void> DOMRectReadOnly::serialization_steps(HTML::SerializationRecord& serialized, bool)
WebIDL::ExceptionOr<void> DOMRectReadOnly::serialization_steps(HTML::SerializationRecord& serialized, bool, HTML::SerializationMemory&)
{
// 1. Set serialized.[[X]] to values x coordinate.
HTML::serialize_primitive_type(serialized, this->x());

View File

@ -70,7 +70,7 @@ public:
}
virtual StringView interface_name() const override { return "DOMRectReadOnly"sv; }
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage) override;
virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage, HTML::SerializationMemory&) override;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position) override;
protected:

View File

@ -315,7 +315,7 @@ public:
TRY(serialize_string(m_vm, m_serialized, serializable.interface_name()));
// 1. Perform the serialization steps for value's primary interface, given value, serialized, and forStorage.
TRY(serializable.serialization_steps(m_serialized, m_for_storage));
TRY(serializable.serialization_steps(m_serialized, m_for_storage, m_memory));
}
// 20. Otherwise, if value is a platform object, then throw a "DataCloneError" DOMException.