mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb: Use enum for serialization and reimplement interface exposure
Our currently implementation of structured serialization has a design flaw, where if the serialized/transferred type was not used in the destination realm, it would not be seen as exposed and thus we would not re-create the type on the other side. This is very common, for example, transferring a MessagePort to a just inserted iframe, or the just inserted iframe transferring a MessagePort to it's parent. This is what Google reCAPTCHA does. This flaw occurred due to relying on lazily populated HashMaps of constructors, namespaces and interfaces. This commit changes it so that per-type "is exposed" implementations are generated. Since it no longer relies on interface name strings, this commit changes serializable types to indicate their type with an enum, in line with how transferrable types indicate their type. This makes Google reCAPTCHA work on https://www.google.com/recaptcha/api2/demo It currently doesn't work on non-Google origins due to a separate same-origin policy bug.
This commit is contained in:
parent
d6b9bd306c
commit
d08d6b08d3
Notes:
github-actions[bot]
2025-07-15 13:21:14 +00:00
Author: https://github.com/Lubrsi
Commit: d08d6b08d3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5443
Reviewed-by: https://github.com/trflynn89 ✅
25 changed files with 356 additions and 130 deletions
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<GC::Ref<DOMPoint>> matrix_transform(DOMMatrixInit&) const;
|
||||
|
||||
virtual StringView interface_name() const override { return "DOMPointReadOnly"sv; }
|
||||
virtual HTML::SerializeType serialize_type() const override { return HTML::SerializeType::DOMPointReadOnly; }
|
||||
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, HTML::DeserializationMemory&) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue