mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-14 11:53:21 +00:00
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:
parent
924423c596
commit
4669c1ba31
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 value’s is 2D is true:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 value’s x coordinate.
|
||||
HTML::serialize_primitive_type(serialized, m_x);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 value’s x coordinate.
|
||||
HTML::serialize_primitive_type(serialized, this->x());
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue