Commit graph

566 commits

Author SHA1 Message Date
Guillaume Gomez
2f3f4a5bd6 Update rust-mozjs dependency 2016-08-24 12:56:49 +02:00
Boris Zbarsky
5341f852ce Use JS_SplicePrototype to set the right proto on the global, instead of JS_SetPrototype, since the latter will permanently deoptimize it. 2016-08-24 00:43:52 -04:00
Malisa Smith
7fd65affab bindings generator: support default ByteString values in dictionary 2016-08-10 10:50:36 -07:00
Ms2ger
89efccc426 Update SpiderMonkey to m-c bcf4ff0c3eef.
This currently breaks Servo on Android, because there are a number of
interdependent changes that cannot easily land serially in a way that
keeps it working throughout. We expect to fix this in the near future.
2016-07-28 13:05:56 +02:00
Malisa Smith
56bdc002fc Union types now allow ByteString 2016-07-21 19:19:12 -07:00
bors-servo
4ae0897175 Auto merge of #12541 - jdm:seqseq, r=nox
Support sequences of sequences in generated bindings.

This fixes a blocker for #11897. `unroll` recursively gets the inner type of any sequence type encountered, so it's inappropriate for codegen that only wants the immediate inner type. However, if a type identifies as a sequence and is nullable, we need to reach through the nullable wrapper first. Gecko does very similar things.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12528 (github issue number if applicable).
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12541)
<!-- Reviewable:end -->
2016-07-21 14:24:52 -05:00
Josh Matthews
9ef848b65e Support sequences of sequences in generated bindings.
unroll recursively gets the inner type of any sequence type encountered, so it's inappropriate for codegen that only wants the immediate inner type. However, if a type identifies as a sequence and is nullable, we need to reach through the nullable wrapper first. Gecko does very similar things.
2016-07-21 10:26:57 -04:00
Josh Matthews
3c2435a172 Generate a list of supported DOM APIs from parsed WebIDLs. 2016-07-15 18:13:09 -04:00
bors-servo
e2e7013e76 Auto merge of #12395 - jdm:nowrap, r=Ms2ger
Avoid calling JS_WrapValue for same-compartment DOM reflectors

This change shaves off 15-20ns per iteration of the node.firstChild getter test in tests/html/bindings_perf.html. Based on [similar Gecko code](http://searchfox.org/mozilla-central/rev/f43c9e0ffa92e72dbdbcbf57eecf04a43d46da63/dom/bindings/BindingUtils.h#781).

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix (partially) #12358

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12395)
<!-- Reviewable:end -->
2016-07-12 05:50:46 -07:00
Josh Matthews
fc3b785af1 Remove unused imports from codegen. 2016-07-12 08:22:51 -04:00
Ms2ger
d678b20616 Implement the [Exposed] extended attribute on interfaces.
Fixes #2823.
2016-07-12 13:06:56 +02:00
Ms2ger
4c31c8ac7b Simplify CGConstructorEnabled. 2016-07-12 13:06:54 +02:00
Ms2ger
28630f5487 Make DefineDOMInterface and ConstructorEnabled unsafe functions. 2016-07-12 13:06:53 +02:00
Ms2ger
e99054f731 Add support for unsafe Rust-ABI functions to CGAbstractMethod. 2016-07-12 13:06:52 +02:00
Ms2ger
1dcdc2859c Generate 'pub' before 'unsafe extern', if both are used. 2016-07-12 13:06:51 +02:00
Ms2ger
b5412f3840 Correct indentation in the DOMClass function. 2016-07-12 13:06:50 +02:00
bors-servo
80cb0cf821 Auto merge of #11872 - eddyb:back-to-roots, r=Ms2ger
Replace return_address usage for rooting with stack guards and convenience macros.

The existing `Rooted` and `RootedVec` users were migrated the the following two macros:
```rust
let x = Rooted::new(cx, value);
// Was changed to:
rooted!(in(cx) let x = value);
// Which expands to:
let mut __root = Rooted::new_unrooted(value);
let x = RootedGuard::new(cx, &mut __root);
```
```rust
let mut v = RootedVec::new();
v.extend(iterator);
// Was changed to:
rooted_vec!(let v <- iterator);
// Which expands to:
let mut __root = RootableVec::new();
let v = RootedVec::new(&mut __root, iterator);
```

The `rooted!` macro depends on servo/rust-mozjs#272.
These APIs based on two types, a container to be rooted and a rooting guard, allow implementing both `Rooted`-style rooting and `Traceable`-based rooting in stable Rust, without abusing `return_address`.

Such macros may have been tried before, but in 1.9 their hygiene is broken, they work only since 1.10.

Sadly, `Rooted` is a FFI type and completely exposed, so I cannot prevent anyone from creating their own, although all fields but the value get overwritten by `RootedGuard::new` anyway.
`RootableVec` OTOH is *guaranteed* to be empty when not rooted, which makes it harmless AFAICT.

By fixing rust-lang/rust#34227, this PR enables Servo to build with `-Zorbit`.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix rust-lang/rust#34227
- [x] These changes do not require tests because they are not functional changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11872)
<!-- Reviewable:end -->
2016-07-04 11:03:35 -07:00
Eduard Burtescu
b79a7d468e Use a stack guard and a macro for RootedVec instead of return_address. 2016-07-04 20:59:06 +03:00
Eduard Burtescu
0db1faf876 Switch to using the new rooted!/RootedGuard API for rooting. 2016-07-04 20:59:01 +03:00
Corey Farwell
22928f50ac Refactor util::prefs operations to be methods on static struct. 2016-07-02 16:43:39 -04:00
Ms2ger
296afe4bc9 Use ObjectOpResult::succeed. 2016-06-27 17:59:08 +02:00
Ms2ger
300f2df203 Remove a useless local variable. 2016-06-27 17:59:07 +02:00
Josh Matthews
b8853554db Wrap executions of Rust code called from JS in catch_unwind. Propagate the interrupted panic to the origin of the JS execution via TLS before resuming. Fix #6462. 2016-06-22 09:35:19 -04:00
Jansen Jan
fda011923e Support WindowProxy return values in bindings
unscopable
2016-06-09 23:42:27 +02:00
Anthony Ramine
3529803975 Implement [Unscopable] (fixes #11583) 2016-06-07 15:34:44 +02:00
Anthony Ramine
3cc7b575fb Initialise reflector earlier for globals
This allows us to use global_root_from_object in the context of a Condition.
2016-05-27 14:11:34 +02:00
Anthony Ramine
e179cb02ff Implement [Func] 2016-05-27 00:55:02 +02:00
Anthony Ramine
fd7c4f8149 Remove utils::Prefable in favour of guard::Guard 2016-05-26 23:56:13 +02:00
Anthony Ramine
a20db08f06 Remove Prefable::terminator 🤖 2016-05-26 23:55:37 +02:00
Anthony Ramine
adcecda047 Simplify how Prefable arrays are passed in bindings::interface 2016-05-26 23:55:36 +02:00
Anthony Ramine
bee6f59b16 Use itertools.groupby in generatePrefableArray 2016-05-26 23:55:35 +02:00
Anthony Ramine
b094932d57 Make MemberCondition a function returning a plain string 2016-05-26 23:55:31 +02:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Anthony Ramine
60aaac5175 Remove the custom PartialEq implementations on TypeId enums
https://github.com/rust-lang/rust/pull/33593 made them useless.
2016-05-17 15:30:14 +02:00
Anthony Ramine
4af3e9028d Use JS_NewStringCopyN for the representation of interface objects
This removes the need for the final null byte and we can make
NonCallbackInterfaceObjectClass::new safe again I guess.
2016-05-16 15:22:07 +02:00
Ms2ger
735480c184 Stop using JSAutoRequest. 2016-05-13 15:34:38 +02:00
Emilio Cobos Álvarez
91101f6226
codegen: Throw a more descriptive invalid enum message 2016-05-13 11:44:39 +02:00
Emilio Cobos Álvarez
e50d4b7624
codegen: Throw on an invalid enum value when appropiate 2016-05-13 11:44:38 +02:00
Emilio Cobos Álvarez
92ba0b9c39
codegen: Don't unconditionally set non-required dictionary attributes 2016-05-13 09:42:51 +02:00
Emilio Cobos Álvarez
203898c941
codegen: Use the non-mangled name in set_dictionary_property
Fixes #11152
2016-05-12 15:39:54 +02:00
bors-servo
b054cb82a6 Auto merge of #9890 - AgostonSzepessy:update-webidl-tests, r=nox
update.sh downloads all *.py tests from mozilla central

components/script/dom/bindings/codegen/parser/update.sh downloads all *.py tests from https://dxr.mozilla.org/mozilla-central/source/dom/bindings/parser/tests

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9890)
<!-- Reviewable:end -->
2016-05-09 05:04:57 -07:00
bors-servo
2c69278067 Auto merge of #10756 - servo:smup, r=Ms2ger
Update SpiderMonkey

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10756)
<!-- Reviewable:end -->
2016-05-03 15:46:40 -07:00
Anthony Ramine
eb94f1a918 Update SpiderMonkey 2016-05-03 18:36:11 +02:00
Josh Matthews
cb5bad63dc Implement hiding of interface members via Pref annotations. 2016-05-02 14:32:56 -04:00
Josh Matthews
88059acd7e Start generating arrays of specs for easier implementation of preference checks. 2016-05-02 14:32:55 -04:00
Josh Matthews
bb47f72f25 Support controlling the visibility of WebIDL interfaces via the Pref annotation. 2016-04-29 11:03:15 -04:00
Anthony Ramine
4c2ca7a8c9 Refactor the call hook on non-callback interface objects (fixes #10744)
It's now set through the intermediate InterfaceConstructorBehavior structure,
which lets us improve the abstraction around NonCallbackInterfaceObjectClass
a bit better.

When the interface's constructor is supposed to always throw, the error for
calling `Foo()` without new is "Illegal constructor.". when the interface
actually defines an interface, the error is instead
"This constructor needs to be called with `new`.".
2016-04-25 11:44:59 +02:00
Anthony Ramine
a45f117838 Make NonCallbackInterfaceObjectClass::new unsafe 2016-04-25 10:51:07 +02:00
Keith Yeung
c6b6d2c84e Avoid generating parameter names that are Rust keywords 2016-04-17 19:37:42 -04:00
Arnaud Marant
315120d6e8 remove unreachable code in codegen
code is unreachable after return, and identical to the upper block
2016-04-12 19:10:10 +02:00