-
-
Notifications
You must be signed in to change notification settings - Fork 2k
LibWeb: Generate some more code for serializable objects #5497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
715c138
to
030c581
Compare
@@ -1105,16 +1064,15 @@ WebIDL::ExceptionOr<SerializedTransferRecord> structured_serialize_with_transfer | |||
|
|||
static bool is_transferable_interface_exposed_on_target_realm(TransferType name, JS::Realm& realm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably also replace the TransferType
enum with InterfaceName
, which will also allow us to get rid of this function as well, but we would need to add ArrayBuffer
and ResizableArrayBuffer
to InterfaceName
. Maybe that is fine though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems fine to me. we could hardcode it in the generator.
though, it seems like we've got a couple uses for all this type metadata. one is "is this object exposed on a global of type X". Another is "can we serialize or transfer this type". Is it correct to use the same generic-sounding "interface name" enum for all those?
Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWindowOrWorkerInterfaces.cpp
Outdated
Show resolved
Hide resolved
Your pull request has conflicts that need to be resolved before it can be reviewed and merged. Make sure to rebase your branch on top of the latest |
5f8c415
to
d5fb498
Compare
4ed618c
to
fb991ae
Compare
Your pull request has conflicts that need to be resolved before it can be reviewed and merged. Make sure to rebase your branch on top of the latest |
While this does cost us an extra byte to serialize as it contains _all_ interface names instead of the set of serializable types, doing this will allow us to remove to use the same enum for checking whether that interface is exposed in a future commit.
The actual name of the web interface is "URL", not "DOMURL. We only call it DOMURL to avoid name conflicts with URL::URL.
By making use of the WEB_PLATFORM_OBJECT macro we can remove the boilerplate of needing to add this override for every serializable platform object so that we can check whether they are exposed or not.
`interface_name` is implemented for every platform object, so we no longer need this boilerplate for every serializable platform object.
This ends up having no effect since we're falling back to DOM::Event (which is always exposed) for `TouchEvent`, which is the platform object that a user agent may chose to not expose. But since this is trivial to implement, let's just add this in now.
fb991ae
to
e37ef95
Compare
Sitting on top of #5492.
Makes use of the IDL generator to reduce some of the boilerplate of serializable objects and makes it a bit easier to check if a given platform object is exposed for a given realm.