Commit graph

571 commits

Author SHA1 Message Date
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
Hugo Thiessard
4654dd91a8 Issue #13377 Extract panic-catching for JS engine callbacks into a
separate function
2016-09-26 19:20:22 +02:00
Anthony Ramine
107b92cc62 Update the WebIDL parser 2016-09-26 13:17:12 +02:00
Mátyás Mustoha
fd778b4240 Enqueue promise jobs from SpiderMonkey callbacks, and execute them in batches. Implement native Promise APIs.
Add SpiderMonkey hooks for enqueuing promise jobs. Start porting various native Promise APIs.
2016-09-22 16:16:49 -04:00
Josh Matthews
a1091772ec Implement binding support for returning and accepting Promises in WebIDL. 2016-09-22 16:16:48 -04:00
bors-servo
73b2963509 Auto merge of #13333 - splav:JS-setters-fix#13327, r=jdm
fix JS IndexedGetter and NamedSetter bindings generation

<!-- Please describe your changes on the following line: -->
Fix JS IndexedGetter and NamedSetter bindings generation.

---
<!-- 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 #13327 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because the test will be in PR for #13129 as currently these setters are used by nobody.

<!-- 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/13333)
<!-- Reviewable:end -->
2016-09-22 01:36:25 -05:00
Ms2ger
2d83e5a788 Implement the MozMap type.
Fixes #13144.
2016-09-21 14:03:34 +02:00
Ms2ger
9a9ca45084 Introduce wrapInNativeContainerType. 2016-09-21 14:03:33 +02:00
Ms2ger
9371889a03 Use innerContainerType in getConversionConfigForType. 2016-09-21 13:44:31 +02:00
Ms2ger
b2fc80a847 Rename innerSequenceType to innerContainerType. 2016-09-21 13:42:35 +02:00
Ms2ger
e942f50e1b Handle unsupported types better in getUnionTypeTemplateVars. 2016-09-21 13:17:05 +02:00
Ms2ger
d1d2074d43 Improve handling of ConversionResult::Failure in unions. 2016-09-21 13:17:04 +02:00
Ms2ger
6023560863 Improve jsid_to_str's name and documentation. 2016-09-21 13:17:03 +02:00
Alexandrov Sergey
3488d15022 fix JS IndexedGetter and NamedSetter bindings generation 2016-09-20 14:50:21 +03:00
bors-servo
84f3cf22bf Auto merge of #13185 - nox:namespaces, r=jdm,Ms2ger
Make console a namespace (fixes #13010)

<!-- 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/13185)
<!-- Reviewable:end -->
2016-09-10 07:33:25 -05:00
bors-servo
1b3c7ed0ee Auto merge of #13201 - KiChjang:codegen-typedefs, r=nox
Properly generate typedef identities in unions

Fixes #10605.

<!-- 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/13201)
<!-- Reviewable:end -->
2016-09-09 18:45:56 -05:00
Anthony Ramine
0b689a8a31 Implement WebIDL namespaces 2016-09-08 11:01:34 +02:00
Keith Yeung
3976d974fc Properly generate typedef identities in unions 2016-09-07 21:48:46 -07:00
Anthony Ramine
8ba0cf30a1 Fix descriptor argument in CGCallGenerator.__init__
It's a descriptor, not a descriptor provider.
2016-09-07 15:48:22 +02:00
Josh Matthews
8653450b6e Extract mutability out of Reflectable trait. 2016-09-07 10:40:13 +02:00
bors-servo
628c644fee Auto merge of #13183 - nox:cleanup-interface, r=Ms2ger
Clean up stuff in bindings::interface

<!-- 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/13183)
<!-- Reviewable:end -->
2016-09-06 08:48:15 -05:00
Ms2ger
00559f18b1 Add missing IsCallable checks. 2016-09-06 13:59:44 +02:00
Anthony Ramine
a60634b998 Fix case of InterfaceObjectClass in codegen 2016-09-06 13:31:25 +02:00
Anthony Ramine
86996fdf83 Remove NonNullJSNative 2016-09-06 10:14:11 +02:00
Anthony Ramine
51e46b11a3 Move WebIDL constants machinery to bindings::constant 2016-09-06 10:14:11 +02:00
Anthony Ramine
109a297309 Simplify InterfaceConstructorBehavior 2016-09-06 10:13:55 +02:00
Anthony Ramine
7dfb336be8 Use Option<T> to return from getters
This removes the cumbersome &mut bool argument and offers overall
a more readable code.
2016-08-30 19:07:19 +02:00
Anthony Ramine
6e1523f4ae Compile WebIDL return type "object" to NonZero<*mut JSObject> 2016-08-30 19:07:13 +02:00
tp6vup54
59dcb31491 Convert imports in generate_imports into one per line, so that it can easily add new ones with alphabetical order. 2016-08-27 14:45:47 +08:00
Tetsuharu OHZEKI
0277cf9174 Make DOMJSClass use JSClass instead of Class (fixes #13031) 2016-08-26 22:31:09 +02:00
Anthony Ramine
dccf771e25 Implement [Replaceable] (fixes #13033) 2016-08-26 10:37:59 +02:00
Anthony Ramine
6c1167b1e2 Pass the receiver to get_property_on_prototype (fixes #11600) 2016-08-25 15:48:07 +02:00
Anthony Ramine
f70fa98954 Make has_property_on_prototype fallible 2016-08-25 15:46:43 +02:00
Anthony Ramine
241de3dfd0 Call JS_SetImmutablePrototype for prototypes of globals (fixes #13023) 2016-08-25 14:29:27 +02:00
Anthony Ramine
6da56f7e67 Define interface members on the global object directly (fixes #4593) 2016-08-25 14:29:16 +02:00
Anthony Ramine
0729000b56 Pass a MutableHandleObject to create_global_object 2016-08-25 14:03:09 +02:00
Anthony Ramine
5f59bb2e0c Make create_global_object take a &'static Class 2016-08-25 14:03:08 +02:00
Anthony Ramine
a4f2159e36 Rename utils::create_dom_object to interface::create_global_object 2016-08-25 14:03:07 +02:00
Anthony Ramine
32a600246e Split global logic out of CGWrapMethod 2016-08-25 14:02:52 +02:00
bors-servo
1370fa5e3b Auto merge of #12819 - jdm:iterable2, r=nox
Support pair and value iterable WebIDL bindings

The actual iterator implementation and JSAPI calls related to setting up the interface are ported directly from Gecko's Codegen.py, IterableIterator.h, and IterableIterator.webidl. The changes to support multiple interfaces in one file are required because the internal iterator interface the parser generates gets associated with the original interface's WebIDL file. It seemed like a good time to address #571 in that case.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12628 and fix #571.
- [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/12819)
<!-- Reviewable:end -->
2016-08-24 12:47:53 -05:00
Josh Matthews
86a0c45f87 Use named arguments for CGImports. 2016-08-24 13:47:26 -04:00
Josh Matthews
6492c090f1 Set up the iterator prototype as the prototype of iterator interfaces, and alias forEach to the entries method. 2016-08-24 13:47:24 -04:00