servo/components/script
bors-servo fd7698c3ea
Auto merge of #29805 - jdm:dom-protos, r=mrobinson
Support extending DOM classes in JS

Adds support for determining the correct prototype as part of a `new` call for non-HTML constructors. Support for HTML constructors [was added](https://github.com/servo/servo/blob/master/components/script/dom/bindings/htmlconstructor.rs#L116) as part of the custom element work, but that wasn't enough for extending other DOM objects like `EventTarget`.

This work is based on Gecko's code in https://searchfox.org/mozilla-central/rev/2d678a843ceab81e43f7ffb83212197dc10e944a/dom/bindings/BindingUtils.cpp#3667, and is split into two parts:
1) the actualy new implementation (demonstrating that extending `EventTarget` works as expected)
2) plumbing the new prototype through all of the rest of the DOM object construction code.

This ends up being more complex than the way it's done in Gecko because they have lazy DOM reflectors, so their native DOM objects can be constructed without any knowledge of a JS prototype. Servo's reflectors are eager, however, so we need to propagate prototype information into individual constructors. As a result, this was a tedious set of changes to make.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29770
- [x] There are tests for these changes
2023-06-01 05:06:09 +02:00
..
docs
dom Auto merge of #29805 - jdm:dom-protos, r=mrobinson 2023-06-01 05:06:09 +02:00
layout_dom Further changes required by Servo 2023-05-27 05:59:01 +02:00
task_source
animation_timeline.rs
animations.rs Fix flakiness in animation tests 2023-05-02 08:37:15 +02:00
body.rs Fix formatting. 2023-05-20 11:05:10 -04:00
build.rs Port some code to Python3 2021-02-18 09:35:46 -05:00
canvas_state.rs Bump euclid to 0.22 2023-01-26 08:59:21 +01:00
Cargo.toml De-dupe phf 2023-05-23 00:53:09 +00:00
clipboard_provider.rs
devtools.rs Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
document_loader.rs
euclidext.rs
fetch.rs Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
image_listener.rs
init.rs Added is_platform_object_static check to is_dom_object 2020-11-26 18:40:41 -05:00
layout_image.rs
lib.rs Eliminate duplicate Layout DOM wrappers 2023-05-05 17:16:38 +02:00
mem.rs
microtask.rs Enter realms more consistently during the script event loop. 2023-05-20 14:30:22 -04:00
network_listener.rs
realms.rs Remove unused argument from AlreadyInRealm::assert. 2023-05-20 11:05:09 -04:00
script_module.rs Fix formatting. 2023-05-20 11:05:10 -04:00
script_runtime.rs Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
script_thread.rs Enter realms when creating special same-origin iframes. 2023-05-20 18:32:08 -04:00
serviceworker_manager.rs feat: shorten thread names 2021-07-19 00:57:48 +09:00
stylesheet_loader.rs Further changes required by Servo 2023-05-30 23:09:43 +02:00
stylesheet_set.rs
task.rs ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
task_manager.rs ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
task_queue.rs
test.rs
textinput.rs
timers.rs Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
unpremultiplytable.rs
webdriver_handlers.rs Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
window_named_properties.rs add spec issue as todo in [[OwnPropertyKeys]] trap 2023-03-23 19:15:20 +08:00