Commit graph

70 commits

Author SHA1 Message Date
Josh Matthews
c60e4afbee
Support custom derives for generated types (#34356)
* script: Derive more Default implementations for dictionaries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Support arbitrary derives on generated enums.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Support arbitrary derives for generated dictionaries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Support arbitrary derives for generated unions.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Derive more impls for generated dicts and unions.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Implement FromStr for generated enums.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* crown: Allow returning unrooted values from Default::default.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-11-24 18:15:50 +00:00
Andriy Sultanov
e5150dbda1
Propagate CanGc from Document::new() (#33386)
* Add canGc as a parameter to autogenerated trait methods

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

* Propagate CanGc from Document::new()

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

---------

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
2024-09-09 22:38:01 +00:00
Ngo Iok Ui (Wu Yu Wei)
8eed3b442b
Update WebIDL.py (#32495)
* Update WebIDL.py

* Update WebIDL.py

* Add builtin-array.patch

* Fix CodegenRust.py and Configuration.py

* Fix missing downcasts

* mach fmt

* Update check and comment to explain why we need this check

* Update Global of DissimilarOriginWindow.webidl
2024-06-15 04:22:42 +00:00
Samson
794110ebe5
webgpu: Move errorscopes to WGPU thread (#32304)
* Prepare errorscopes logic in wgpu_thread

* remove scope_id from ipc

* new GPUErrors per spec

* remove cotent timeline error_scope

* fixup poperrorscope types

* device_scope -> gpu_error and nice errors

* Handle errors detection more elegantly

* good expectations

* new expectations

* Make error_scope.errors Vec as per spec
2024-05-22 16:47:35 +00:00
Samson
8bc49299c8
Revert "script: implement AbortController (#31361)" (#32243)
This reverts commit 7fce850cff.
2024-05-07 06:23:14 +00:00
Smitty
7fce850cff
script: implement AbortController (#31361)
* Implement AbortController

Signed-off-by: syvb <me@iter.ca>

* Update WPT tests

Signed-off-by: syvb <me@iter.ca>

* Address review comments

* Fix duplicate import generation

* Update WPT test expectations

* Change expectation to FAIL for flaky test

---------

Signed-off-by: syvb <me@iter.ca>
2024-05-04 15:00:01 +00:00
Olivier Tilloy
8dcf3dd0b0
Fix trivial typo in variable name (#31143) 2024-01-21 06:54:56 +00:00
Samson
ddc47aa56b
Codegen support multiple interfaces in single webidl file & WebGPU single webidl (#30448)
* Codegen support multiple interfaces in single webidl file

* Merge GPU*.webidl into WebGPU.webidl

* Update gpu files to use WebGPUBinding module file
2023-09-30 12:30:12 +00:00
Samson
ebd41d4101
Use Foo_Binding instead of FooBinding for namespace modules (#30447)
* Update Codegen.py to emit Foo_Binding instead of FooBinding

* s/FooBinding/Foo_Binding/g
2023-09-30 00:52:04 +00:00
Samson
e0a6281e73
Impl Setlike and Maplike (#30237)
* MallocSizeOf for Index{Set, Map}

* like as iterable in WebIDL

* Codegen magic for like interfaces

* TestBinding for like

* Test for Setlike and Maplike test bindings

* Some fixes

* Switch to any.js

* nit

* Keep order
2023-09-06 13:08:45 +00:00
Delan Azabani
fd1de05592 apply pylbrecht/servo/named.window.getter (closes #27952) 2023-03-23 18:01:26 +08:00
sagudev
ee7c393773 Fix Codegen 2023-02-20 06:16:13 +01:00
yvt
41cce140bc feat(script): implement some of the non-ordinary internal methods of Location
<https://html.spec.whatwg.org/multipage/#the-location-interface>

 - `[[GetPrototypeOf]]`: not yet
 - `[[SetPrototypeOf]]`: not yet
 - `[[IsExtensible]]`: `proxyhandler::is_extensible`
 - `[[PreventExtensions]]`: `proxyhandler::prevent_extensions`
 - `[[GetOwnProperty]]`: `CGDOMJSProxyHandler_getOwnPropertyDescriptor` (updated)
 - `[[DefineOwnProperty]]`: `CGDOMJSProxyHandler_defineProperty` (updated)
 - `[[Get]]`: `CGDOMJSProxyHandler_get` (updated)
 - `[[Set]]`: not yet
 - `[[Delete]]`: `CGDOMJSProxyHandler_delete` (updated)
 - `[[OwnPropertyKeys]]`: `CGDOMJSProxyHandler_ownPropertyKeys` (updated)
2021-07-16 01:26:05 +09:00
Vincent Ricard
a627dde0d0 Port some code to Python3 2021-02-18 09:35:46 -05:00
Josh Matthews
63528f6fdf dom: Generate iterator symbol for interfaces with indexed getters. 2020-07-09 23:22:48 -04:00
Kagami Sascha Rosylight
d01648d637 Fix remaining flake8 warnings 2020-06-21 03:34:32 +02:00
Kunal Mohan
5a3e1b8e69
rename compartment to realm 2020-01-24 20:52:36 +05:30
marmeladema
7b5fabe855 Fix tidiness errors for Python3 compatibility across whole repo 2019-12-11 16:03:20 +00:00
Kagami Sascha Rosylight
e271edad92 Convert [HTMLConstructor] as constructor extension 2019-10-19 20:55:45 +09:00
Kagami Sascha Rosylight
2660f35925 Remove [PrimaryGlobal] 2019-10-03 14:25:23 +09:00
Kagami Sascha Rosylight
16b4e3446b Support default toJSON in WebIDL 2019-07-24 22:01:55 +09:00
Bastien Orivel
7dbff6efb7 Add an inCompartments config for bindings 2019-05-24 23:02:38 +02:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Simon Sapin
acabd50f03 Use 2018-style paths in generated DOM bindings 2018-11-06 15:14:17 +01:00
Anthony Ramine
938f1362e7 Update the WebIDL parser 2018-04-03 14:06:07 +02:00
Keith Yeung
ce8486ab9b Import sequence inner types if it appears in dictionary members 2017-11-08 04:20:30 -08:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Connor Brewster
0713257add Generate GetConstructorObject for all interfaces 2017-06-13 15:24:03 -06:00
Ms2ger
85585d9334 Remove unused Descriptor.needsRooting field. 2017-02-08 12:40:19 +01:00
Anthony Ramine
3f91ce1d07 Don't generate constructor IDs for inline interfaces 2017-01-03 14:12:19 +01:00
Anthony Ramine
5a42bb58f9 Implement [Inline] interfaces
Inline interfaces just appear as a Rust type and in the TypeId hierarchy.
They are completely invisible on the JS side.
2016-10-06 20:59:08 +02:00
Josh Matthews
ef501603bf Ensure Promise "reflector" is not GCed before the Rust object. 2016-09-22 16:16:54 -04:00
Josh Matthews
a1091772ec Implement binding support for returning and accepting Promises in WebIDL. 2016-09-22 16:16:48 -04:00
Anthony Ramine
0b689a8a31 Implement WebIDL namespaces 2016-09-08 11:01:34 +02:00
Josh Matthews
812a761abf Implement pair iterators in WebIDL interfaces. 2016-08-24 11:26:01 -04:00
Josh Matthews
221bc84693 Support multiple WebIDL interfaces being generated in the same output binding file.
Each interface gets its own module named ${Interface}Binding. Structs, enums, and callbacks
continue to use the root module of the binding file. If there is only one interface in the
file, we generate reexports for several public APIs and types so that existing DOM implementations
don't need any modifications. When multiple interfaces exist, the reexported names get the interface
name prepended (eg. FooWrap instead of Wrap).

As part of this work, stop glob-importing all DOM types in every generated binding and start generating
more targeted lists of relevant types based on the methods, members, etc. of WebIDL types that are in use.
2016-08-24 11:25:58 -04:00
Josh Matthews
3c2435a172 Generate a list of supported DOM APIs from parsed WebIDLs. 2016-07-15 18:13:09 -04:00
Ms2ger
d678b20616 Implement the [Exposed] extended attribute on interfaces.
Fixes #2823.
2016-07-12 13:06:56 +02:00
Ms2ger
c064c4950d Make sure that Descriptor.isGlobal() returns a bool. 2016-07-12 13:06:55 +02:00
Jansen Jan
fda011923e Support WindowProxy return values in bindings
unscopable
2016-06-09 23:42:27 +02:00
Josh Matthews
f4c1529f56 Forbid unconditionally-exposed interfaces that inherit from conditionally-exposed ones. 2016-05-02 14:32:53 -04:00
Josh Matthews
bb47f72f25 Support controlling the visibility of WebIDL interfaces via the Pref annotation. 2016-04-29 11:03:15 -04:00
Zbynek Winkler
b6dc34862a Use os.path.basename instead of split('/')[-1]
Fixes #10596.
2016-04-17 17:37:29 +02:00
Anthony Ramine
ca979e115b Cache legacy callback interface objects in proto_or_icache_array
We need them to be cached to not instantiate them multiple times with
lazy initialisation.
2016-02-25 15:15:44 +01:00
Prabhjyot Singh Sodhi
d6df844ae5 generate typedefs in CodegenRust 2016-01-26 21:56:44 +05:30
Anthony Ramine
d52948dfd5 Introduce Descriptor.prototypeDepth 2016-01-12 12:34:18 +01:00
bors-servo
8dc4b8dcb9 Auto merge of #8993 - nox:small-codegen-slimming, r=Ms2ger
Slightly reduce the output of codegen

Interfaces which we know are never instantiated can generate less code.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8993)
<!-- Reviewable:end -->
2015-12-18 06:35:15 +05:30
Anthony Ramine
372da02a42 Link [Abstract] to the existing concrete descriptor field
This makes codegen not emit anything strictly related to the interface which
are never used in the case of abstract interfaces, such as the Wrap method
or the DOMJSClass.
2015-12-16 00:42:15 +01:00
Anthony Ramine
06947965b1 Remove all our local patches to the WebIDL parser
All the tweaks we need can just be made through Configuration.py, and
[Abstract] is being submitted upstream by Ms2ger.
2015-12-15 23:06:35 +01:00
Anthony Ramine
60976406cc Implement [Unforgeable]
This is mostly stolen from Gecko. As there, we define the unforgeable members
on an object stored in the slots of the prototype object. They are then copied
onto instance objects when they are instantiated. It should be noted that
proxy objects see their unforgeable memebers defined on their expando object.

Unforgeable attributes aren't properly inherited in codegen (in a similar
fashion as getters and setters as filed in #5875) and require to be redefined
in derived interfaces. Fortunately, there are currently no such interfaces.

No unforgeable members can be included into the TestBinding interfaces for good
measure because they are not compatible with setters.

Given the unforgeable holder object has the same prototype as actual instances
of the interface, the finalize hook needs to check its slot pointer for nullity
before dropping it.

The new failing test isn't related to Unforgeable attributes, but to the fact
that all Document instances currently have a Location, even if their window
isn't in a browsing context.
2015-12-02 22:15:11 +01:00