Commit graph

612 commits

Author SHA1 Message Date
Ms2ger
d9013e069c Root the arguments to callback functions.
Note that this relies on the fact that Heap<JSVal> and JSVal are binary
compatible.

Fixes #15324.
2017-02-01 14:27:37 +01:00
Ms2ger
f376f9c2d7 Improve the readability of dictionaries' new() method. 2017-01-31 16:37:31 +01:00
bors-servo
eade32ed16 Auto merge of #15099 - servo:phf-no-macros, r=jdm
Remove usage of phf_macros.

It’s a compiler plugin that uses unstable compiler APIs that are not on a path to stabilization.

With this changes, there is one less thing that might break when we update the compiler. For example: https://github.com/sfackler/rust-phf/pull/101

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/15099)
<!-- Reviewable:end -->
2017-01-20 08:59:26 -08:00
Ms2ger
6a6f339b29 Support dictionaries in unions.
Fixes #11612.
2017-01-20 16:06:33 +01:00
Simon Sapin
0b9ff576e0 script codegen: Avoid modifying in-place a generated file. 2017-01-19 17:13:35 +01:00
bors-servo
e891277dd5 Auto merge of #14994 - jdm:callback_rooting, r=Manishearth,Ms2ger
Make WebIDL callbacks permanently rooted

This replicates the same model that Promise uses right now, because it requires less thinking than coming up with something else.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14447
- [ ] 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/14994)
<!-- Reviewable:end -->
2017-01-16 10:16:44 -08:00
Josh Matthews
3f35c3eee2 Add a permanent root to WebIDL callbacks, ensuring they are always safe to store. 2017-01-13 09:59:57 -05:00
Ms2ger
e57b478710 Remove unused needsRooting field from JSToNativeConversionInfo. 2017-01-12 16:57:44 +01:00
Ms2ger
b8554abaa4 Expose CallbackObject more.
This will make it easier to use new fields added to it.
2017-01-09 14:17:41 +01:00
Ms2ger
baf4e17232 Avoid generating literal nulls in DOM bindings. 2017-01-06 14:24:13 +01:00
bors-servo
839b7fe8ef Auto merge of #14859 - servo:CallSetup, r=nox
Simplify CallSetup.

<!-- 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/14859)
<!-- Reviewable:end -->
2017-01-05 07:33:46 -08:00
Ms2ger
8d633fec42 Simplify CallSetup. 2017-01-05 13:55:10 +01:00
Eric Anholt
af380c2717 Fix JS_ObjectIsDate() call in webidl codegen.
We were missing the import, and the prototype of the function has
since changed.  Partial fix for #10675
2017-01-04 18:02:30 -08:00
Eric Anholt
d90499ab35 Fix is_null_or_undefined() call in codegen to be snake_case.
After a bit of digging, I couldn't find when it was camelCase.  This
started getting generated when I added an overload in webgl.
2017-01-04 09:57:39 -08:00
Anthony Ramine
3f91ce1d07 Don't generate constructor IDs for inline interfaces 2017-01-03 14:12:19 +01:00
Simon Sapin
53f5023685 Fix/silence some warnings 2016-12-20 07:07:06 +01:00
Alan Jeffrey
9be4fd56ce Removed util. 2016-12-14 18:04:37 -06:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Anthony Ramine
ddfb8805dc Make WebIDL static methods take a more specific global if possible 2016-11-30 23:23:42 +01:00
Rohan Prinja
973f77c006 Make WebIDL constructors take a more specific global if possible (fixes #14071) 2016-11-30 23:23:41 +01:00
Anthony Ramine
445701d138 Update js, AGAIN 2016-11-27 12:19:19 +01:00
Ms2ger
e367822b3e Update js. 2016-11-27 12:19:19 +01:00
Abelardo E. Mendoza
b372e7c98f script creates methods taking '*mut JSContext' unsafe
rebase + marked the necessary new code as unsafe
2016-11-14 11:06:17 +01:00
Ms2ger
25d9d2b4ea Add a missing newline. 2016-11-03 16:10:34 +01:00
Ms2ger
558afe1786 Update js. 2016-11-02 13:25:49 +01:00
Nikhil Shagrithaya
51ef05bf3d Implemented FileReader::readAsArrayBuffer 2016-11-01 00:25:26 +05:30
Anthony Ramine
d6479c6f0f Update Rust to 1.14.0-nightly (c59cb71d9 2016-10-26) 2016-10-27 19:18:56 +02:00
Anthony Ramine
45c9aa7487 Generalise RootedReference
It now becomes RootedReference<'root> and includes an associated type for
the return type of its 'r' method.

This removes the need for OptionalRootedReference.
2016-10-11 19:44:33 +02:00
Anthony Ramine
0b3ab875f4 Remove intrinsic Root::r() 2016-10-11 19:44:32 +02:00
Anthony Ramine
ea27f9d5ec Introduce ServoParser
This is a common inline parent to ServoHTMLParser and ServoXMLParser.
2016-10-11 14:50:58 +02:00
bors-servo
a6e4b5bb86 Auto merge of #13596 - nox:inline, r=Ms2ger
Get rid of dom::bindings::global

Globals in that PR are now represented by the fake IDL interface `GlobalScope`.

<!-- 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/13596)
<!-- Reviewable:end -->
2016-10-07 07:52:09 -05:00
Anthony Ramine
d8e92bb271 Rename Reflectable::global_scope to global 2016-10-06 21:36:41 +02:00
Anthony Ramine
b6bbd41e11 Remove GlobalRoot and GlobalRef 2016-10-06 21:36:00 +02:00
Anthony Ramine
144dc62575 Do not use GlobalRoot in CodegenRust anymore 2016-10-06 21:35:55 +02:00
Anthony Ramine
02d38e74e9 Make Promise::Reject and Resolve take a &GlobalScope 2016-10-06 21:35:54 +02:00
Anthony Ramine
26455b8a67 Remove global_root_from_reflector 2016-10-06 21:35:54 +02:00
Anthony Ramine
19108aa330 Pass a &GlobalScope to WebIDL static methods and constructors 2016-10-06 21:35:49 +02:00
Anthony Ramine
896d8d4781 Make throw_dom_exception take a &GlobalScope 2016-10-06 21:35:39 +02:00
Anthony Ramine
fcb59d3057 Make reflect_dom_object take a &GlobalScope 2016-10-06 20:59:09 +02: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
Anthony Ramine
b745866a4d Prevent doing use self::FooBinding::{} 2016-10-06 20:59:08 +02:00
Anthony Ramine
c5ab84638d Make TopTypeId an untagged union 2016-10-06 00:35:04 +02:00
Anthony Ramine
fce0a8e7cf Reorganise CGDescriptor
Group some codegen operations together.
2016-10-02 16:51:59 +02:00
bors-servo
ec4f61e538 Auto merge of #13449 - servo:fill_property_descriptor, r=jdm
Pass a MutableHandle to fill_property_descriptor.

<!-- 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/13449)
<!-- Reviewable:end -->
2016-09-30 05:06:15 -05:00
bors-servo
c212234258 Auto merge of #13508 - tschneidereit:fix-sh-methods-codegen, r=emilio
Fix codegen for iterable's forEach method

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13451 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

The `forEach` method installed on iterable DOM interfaces uses SpiderMonkey's self-hosted implementation of `Array.prototype.forEach`, but it has the wrong value for `nargs`, causing failing asserts in debug and wrong behavior in release builds.

Fixes #13451

<!-- 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/13508)
<!-- Reviewable:end -->
2016-09-29 20:21:32 -05:00
Till Schneidereit
9a8f520047 Fix codegen for iterable's forEach method
The `forEach` method installed on iterable DOM interfaces uses SpiderMonkey's self-hosted implementation of `Array.prototype.forEach`, but it has the wrong value for `nargs`, causing failing asserts in debug and wrong behavior in release builds.

Fixes #13451
2016-09-29 12:35:11 +02:00
bors-servo
341fb72fc9 Auto merge of #13431 - nox:webidl, r=Ms2ger
Update the WebIDL parser

<!-- 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/13431)
<!-- Reviewable:end -->
2016-09-28 07:07:16 -05:00
bors-servo
06bb57bdcb Auto merge of #13406 - Mylainos:issue-13377, r=jdm
Extract panic-catching for JS engine callbacks into a separate function

All of our generated code for script contains inline code like this:
```
let result = panic::catch_unwind(AssertUnwindSafe(|| {
    ...
};
match result {
    Ok(result) => result,
    Err(error) => {
        store_panic_result(error);
        return false;
    }
}
```
This PR change it to something like this:
```
wrap_panic(|| { ... }, false)
```

---
- [X] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [X] These changes fix #13377

- [ ] 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/13406)
<!-- Reviewable:end -->
2016-09-27 09:58:42 -05:00
Ms2ger
6928fbfa31 Pass a MutableHandle to fill_property_descriptor. 2016-09-27 10:29:47 +02:00
Alexandrov Sergey
6bda471007 remove link to #5876 due to everything has been fixed in PR #13333 2016-09-26 21:49:09 +03:00