mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 20:22:18 +03:00
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:
parent
4669c1ba31
commit
31f345fcb0
Notes:
sideshowbarker
2024-07-17 21:16:31 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/31f345fcb0 Pull-request: https://github.com/SerenityOS/serenity/pull/23636
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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 value’s x coordinate to serialized.[[X]].
|
||||
m_x = HTML::deserialize_primitive_type<double>(serialized, position);
|
||||
|
@ -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);
|
||||
|
@ -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 value’s x coordinate to serialized.[[X]].
|
||||
auto x = HTML::deserialize_primitive_type<double>(serialized, position);
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user