LibWeb: Add DeserializationMemory parameter to deserialization_steps()

We want to bring with us the value of DeserializationMemory to
Serializable::deserialization_steps() when doing sub serialization.
This commit is contained in:
Kenneth Myhra 2024-03-10 19:48:33 +01:00 committed by Andreas Kling
parent 4669c1ba31
commit 31f345fcb0
Notes: sideshowbarker 2024-07-17 21:16:31 +09:00
12 changed files with 12 additions and 12 deletions

View File

@ -21,7 +21,7 @@ public:
// https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps
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;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position, HTML::DeserializationMemory&) = 0;
};
}

View File

@ -165,7 +165,7 @@ WebIDL::ExceptionOr<void> Blob::serialization_steps(HTML::SerializationRecord& r
return {};
}
WebIDL::ExceptionOr<void> Blob::deserialization_steps(ReadonlySpan<u32> const& record, size_t& position)
WebIDL::ExceptionOr<void> Blob::deserialization_steps(ReadonlySpan<u32> const& record, size_t& position, HTML::DeserializationMemory&)
{
auto& vm = this->vm();

View File

@ -58,7 +58,7 @@ public:
virtual StringView interface_name() const override { return "Blob"sv; }
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;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const& record, size_t& position, HTML::DeserializationMemory&) override;
protected:
Blob(JS::Realm&, ByteBuffer, String type);

View File

@ -109,7 +109,7 @@ WebIDL::ExceptionOr<void> File::serialization_steps(HTML::SerializationRecord& r
return {};
}
WebIDL::ExceptionOr<void> File::deserialization_steps(ReadonlySpan<u32> const& record, size_t& position)
WebIDL::ExceptionOr<void> File::deserialization_steps(ReadonlySpan<u32> const& record, size_t& position, HTML::DeserializationMemory&)
{
auto& vm = this->vm();

View File

@ -33,7 +33,7 @@ public:
virtual StringView interface_name() const override { return "File"sv; }
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;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position, HTML::DeserializationMemory&) override;
private:
File(JS::Realm&, ByteBuffer, String file_name, String type, i64 last_modified);

View File

@ -759,7 +759,7 @@ WebIDL::ExceptionOr<void> DOMMatrixReadOnly::serialization_steps(HTML::Serializa
}
// https://drafts.fxtf.org/geometry/#structured-serialization
WebIDL::ExceptionOr<void> DOMMatrixReadOnly::deserialization_steps(ReadonlySpan<u32> const& record, size_t& position)
WebIDL::ExceptionOr<void> DOMMatrixReadOnly::deserialization_steps(ReadonlySpan<u32> const& record, size_t& position, HTML::DeserializationMemory&)
{
bool is_2d = HTML::deserialize_primitive_type<bool>(record, position);
// 1. If serialized.[[Is2D]] is true:

View File

@ -116,7 +116,7 @@ public:
virtual StringView interface_name() const override { return "DOMMatrixReadOnly"sv; }
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;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const& record, size_t& position, HTML::DeserializationMemory&) override;
protected:
DOMMatrixReadOnly(JS::Realm&, double m11, double m12, double m21, double m22, double m41, double m42);

View File

@ -79,7 +79,7 @@ WebIDL::ExceptionOr<void> DOMPointReadOnly::serialization_steps(HTML::Serializat
return {};
}
WebIDL::ExceptionOr<void> DOMPointReadOnly::deserialization_steps(ReadonlySpan<u32> const& serialized, size_t& position)
WebIDL::ExceptionOr<void> DOMPointReadOnly::deserialization_steps(ReadonlySpan<u32> const& serialized, size_t& position, HTML::DeserializationMemory&)
{
// 1. Set values x coordinate to serialized.[[X]].
m_x = HTML::deserialize_primitive_type<double>(serialized, position);

View File

@ -46,7 +46,7 @@ public:
virtual StringView interface_name() const override { return "DOMPointReadOnly"sv; }
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;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position, HTML::DeserializationMemory&) override;
protected:
DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w);

View File

@ -65,7 +65,7 @@ WebIDL::ExceptionOr<void> DOMRectReadOnly::serialization_steps(HTML::Serializati
}
// https://drafts.fxtf.org/geometry/#structured-serialization
WebIDL::ExceptionOr<void> DOMRectReadOnly::deserialization_steps(ReadonlySpan<u32> const& serialized, size_t& position)
WebIDL::ExceptionOr<void> DOMRectReadOnly::deserialization_steps(ReadonlySpan<u32> const& serialized, size_t& position, HTML::DeserializationMemory&)
{
// 1. Set values x coordinate to serialized.[[X]].
auto x = HTML::deserialize_primitive_type<double>(serialized, position);

View File

@ -71,7 +71,7 @@ public:
virtual StringView interface_name() const override { return "DOMRectReadOnly"sv; }
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;
virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position, HTML::DeserializationMemory&) override;
protected:
DOMRectReadOnly(JS::Realm&, double x, double y, double width, double height);

View File

@ -949,7 +949,7 @@ public:
else {
// 1. Perform the appropriate deserialization steps for the interface identified by serialized.[[Type]], given serialized, value, and targetRealm.
auto& serializable = dynamic_cast<Bindings::Serializable&>(value.as_object());
TRY(serializable.deserialization_steps(m_serialized, m_position));
TRY(serializable.deserialization_steps(m_serialized, m_position, m_memory));
}
}