servo/components/script
Mukilan Thiyagarajan 3cf4ef61ef
bindings: Fix support for interface members in setlike/maplike. (#35651)
#30151 added support for setlike and maplike declarations in WebIDL, but
the tests only validated if generator code worked with 'DOMString' as
the key type. The support for interface type as members was broken as
`DomRoot<T>` didn't satify the bounds `Eq` and `Hash` needed by the
`Key` and `Value` types in `Setlike` and `Maplike` traits respectively.
In addition, the splitting of bindings into a separate 'script_bindings'
crate had also broken support for this in CodegenRust.py, as the types
used within the definition of `DomTraits` were not referenced using
`Self::`.

This patch fixes the WebIDL code generator by doing a simple string
replacement on the return value of `getRetvalDeclarationForType` so that
the proper `Self::` is used. I'm not not sure if there is a better
approach to this as it seems most logic in CodegenRust.py uses the `D::`
prefix that is expected to be available only when compiling `script`
crate and not `script_bindings`.

This patch also adds the missing trait implementations for `DomRoot` and
ensures that the generated code works for both members of primitive and
interface types by splitting the existing `TestBinding{Map,Set}Like`
interfaces into `TestBinding{Map,Set}LikeWith{Primitive,Interface}`
tests.

Fixes #35542.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-27 07:04:11 +00:00
..
docs Update branch name to main (#30877) 2023-12-16 09:32:20 +00:00
dom bindings: Fix support for interface members in setlike/maplike. (#35651) 2025-02-27 07:04:11 +00:00
layout_dom Support the <meter> element (#35524) 2025-02-21 16:28:12 +00:00
xpath Update to rust 1.85 (#35628) 2025-02-24 17:44:35 +00:00
animation_timeline.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
animations.rs Implement Event propagation across shadow roots (#34884) 2025-01-22 15:25:16 +00:00
body.rs refactor: add CanGc as argument to Promise::reject_error (#35646) 2025-02-25 10:12:58 +00:00
build.rs script: Move code generation and webidl files to new script_bindings crate. (#35157) 2025-01-24 20:47:43 +00:00
canvas_context.rs Unify (Offscreen)CanvasRenderingContext2d and make PaintRenderingContext2D standalone (#35619) 2025-02-23 16:31:06 +00:00
canvas_state.rs Do not assume OffscreenCanvasContext to be 2d (#35629) 2025-02-24 14:06:08 +00:00
Cargo.toml Make WebBluetooth an optional feature. (#35479) 2025-02-18 04:13:43 +00:00
clipboard_provider.rs libservo: Add a ClipboardDelegate and a default implementation (#35297) 2025-02-07 10:43:46 +00:00
conversions.rs suppress build warnings when disabling webgpu and webxr (#35379) 2025-02-08 08:16:21 +00:00
devtools.rs Update to rust 1.85 (#35628) 2025-02-24 17:44:35 +00:00
document_collection.rs script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
document_loader.rs script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
drag_data_store.rs DataTransferItem: improve spec compliance (#35418) 2025-02-16 18:53:35 +00:00
fetch.rs refactor: add CanGc as argument to Promise::reject_error (#35646) 2025-02-25 10:12:58 +00:00
iframe_collection.rs script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
init.rs Make generated bindings generic over DOM types (#35169) 2025-01-25 05:08:49 +00:00
layout_image.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
lib.rs script: Add CanvasContext trait (#35448) 2025-02-21 20:26:27 +00:00
links.rs Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
mem.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
messaging.rs Make WebBluetooth an optional feature. (#35479) 2025-02-18 04:13:43 +00:00
microtask.rs Fire slot change events when the slot content changes (#35137) 2025-01-27 14:13:22 +00:00
navigation.rs Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
network_listener.rs Propagate CanGc arguments through callers in constructors (#35541) 2025-02-20 16:17:45 +00:00
realms.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
script_module.rs Propagate more CanGc (#35604) 2025-02-23 17:28:17 +00:00
script_runtime.rs refactor: propagate CanGc arguments through callers (#35591) 2025-02-23 00:34:51 +00:00
script_thread.rs Touch handler: Fix race condition and rate-limit move events (#35537) 2025-02-25 07:13:16 +00:00
security_manager.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
serviceworker_manager.rs api: Flatten and simplify Servo preferences (#34966) 2025-01-14 13:54:06 +00:00
stylesheet_loader.rs Update to rust 1.85 (#35628) 2025-02-24 17:44:35 +00:00
stylesheet_set.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
task.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
task_manager.rs script: add skeleton implementation of FontFace API (#35262) 2025-02-19 05:50:01 +00:00
task_queue.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
task_source.rs script: add skeleton implementation of FontFace API (#35262) 2025-02-19 05:50:01 +00:00
test.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
textinput.rs Update to rust 1.85 (#35628) 2025-02-24 17:44:35 +00:00
timers.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
unminify.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
webdriver_handlers.rs libservo: Move WebDriver messages to the embedder crate (#35602) 2025-02-24 13:57:28 +00:00
window_named_properties.rs window: avoid NonNull<JSObject> in NamedGetter (#35508) 2025-02-17 12:48:21 +00:00