Commit graph

48 commits

Author SHA1 Message Date
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
Anthony Ramine
72c67efe96 Introduce trait WeakReferenceable
This allows to take weak references of JS-managed DOM objects.
2015-11-12 12:51:50 +01:00
Anthony Ramine
acb13dc899 Support variadic interface arguments (fixes #8159)
We use a RootedVec value in codegen, of which we use the `r()` method to
pass `&[&T]` to the interface methods.
2015-11-11 14:52:21 +01:00
Anthony Ramine
aab2c40389 Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
Anthony Ramine
e24b8ab644 Don't generate useless InheritTypes interfaces
Interfaces with no descendant need neither a Base trait nor upcast functions,
and interfaces with no ancestors neither a Derived trait nor downcast functions.
2015-10-02 16:15:12 +02:00
Corey Farwell
d8da5c20f6 Remove deprecated 'creator' WebIDL attribute
According to @Ms2ger, the 'creator' attribute was merged into 'setter'
2015-09-21 07:12:17 -04:00
Michael Wu
941f7dc04b Move EventTargetTypeId/NodeTypeId to DOMClass 2015-09-12 01:09:46 +02:00
Josh Matthews
40806977b5 Add infrastructure for supporting dashed CSS property names on CSSStyleDeclaration. 2015-08-28 13:15:16 -04:00
Corey Farwell
a276bfa57c Remove dead Python code in binding generating code
Fixes #6956
2015-08-05 09:17:30 -04:00
Corey Farwell
0ec2375cab Remove tidy blacklist for 'script/dom/bindings/*'
Recently, I found myself reading through the Python codegen scripts that
live in 'components/script/dom/bindings/*' and noticed that there were
many tidy violations: unnecessary semicolons, weird spacing, unused
variables, lack of license headers, etc. Considering these files are now
living in our tree and mostly maintained directly by contributors of
Servo (as opposed to being from upstream), I feel these files should not
be excluded from our normal tidy process. This commit removes the
blacklist on these files and fixes all tidy violations.

I added these subdirectories to the blacklist because they appear to be
maintained upstream somewhere else:

* "components/script/dom/bindings/codegen/parser/*",
* "components/script/dom/bindings/codegen/ply/*",

Also, I added a '# noqa' comment which tells us to ignore the
flake8 errors for that line. I chose to ignore this (instead of fixing
it) to make the work for this commit simpler for me.
2015-07-09 19:42:31 +09:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
Anthony Ramine
2a2e8b176d Properly generate proxy stringifiers 2015-04-29 18:52:38 +02:00
Chris Paris
d2b0d5e040 Support callback interfaces with constants. 2015-04-11 09:34:44 -10:00
Chris Manchester
c81f1cc541 Add support for BinaryName attribute to servo's codegen (fixes #4435) r=jdm 2015-02-27 18:28:01 -08:00
Chris Manchester
00f863b4fe Add stringifier method support to CodegenRust.py (fixes #1986)
Add a stringifier to URLUtils (Location). (fixes #4605)

wpt metadata updates for #4605
2015-02-20 11:35:16 -08:00
Ms2ger
147dadce89 Implement an Unrooted smart pointer to replace JS when it is not traced. 2015-02-06 12:33:32 +01:00
Ms2ger
1290c18794 Remove the 'b lifetime from Root.
It does not add any safety, as the reference is constructed from a raw pointer
without limiting the lifetime in any way.
2015-01-01 20:36:43 +01:00
Ms2ger
95ec20bd97 Remove the 'a lifetime from Root.
It does not add any safety, as the reference is constructed from a raw pointer
without limiting the lifetime in any way.
2015-01-01 20:36:43 +01:00
Bruno de Oliveira Abinader
a9d68474c9 Remove warning from 'deleter' WebIDL codegen 2014-11-06 11:31:58 -08:00
Ms2ger
76ba40d5cb Remove support for {return,native,concrete}Type overrides in Bindings.conf.
We have no reason to support non-default type names, and this commit corrects
the computations for callbacks (which needed the override until now).
2014-10-10 13:13:43 +02:00
Jack Moffitt
c6ab60dbfc Cargoify servo 2014-09-08 20:21:42 -06:00
Renamed from src/components/script/dom/bindings/codegen/Configuration.py (Browse further)