Commit graph

673 commits

Author SHA1 Message Date
yvt
4bc3453174 feat(script): Implement [[Set]] for Location 2021-07-17 15:26:15 +09:00
yvt
bdd20f0139 feat(script): enable js::ProxyOptions::setLazyProto for maybe-cross-origin objects
Setting the lazy proto option allows proxy handlers to provide dynamic
prototype objects. This is necessary for the customization of
`ProxyTraps::{get,set}PrototypeOf` to actually take effect.
2021-07-17 15:26:15 +09:00
yvt
722a239715 feat(script): Implement [[{Get,Set}PrototypeOf]] for Location 2021-07-17 15:26:15 +09: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
yvt
c3de9b72a6 feat(script): use GlobalScope::origin when creating a principals object
The concrete types of `[Global]` DOM interfaces have `origin` methods,
which were used before this commit. Some of them just delegate to
`GlobalScope::origin` while others are implemented differently. This
commit changes the created principals objects' associated origins in the
following way:

 - `DedicatedWorkerGlobalScope` - was `WorkerGlobalScope::worker_url`
 - `DissimilarOriginWindow` - no change
 - `PaintWorkletGlobalScope` - no change
 - `ServiceWorkerGlobalScope` - was `ServiceWorkerGlobalScope::scope_url`
 - `TestWorkletGlobalScope` - no change
 - `Window` - no change
2021-07-13 21:06:52 +09:00
yvt
e786627199 fix(script): apply some of the changes requested in the review comments of #16501 2021-07-12 01:29:41 +09:00
yvt
fd177a9199 Merge remote-tracking branch 'upstream/master' into feat-cow-infra 2021-07-11 22:22:43 +09:00
yvt
01a7de50ab Merge remote-tracking branch 'upstream/master' into feat-cow-infra
`tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html`
was reverted to the upstream version.
2021-07-10 17:55:42 +09:00
yvt
727662a1e6 chore(deps): update mozjs
- a8b688a: Add `ProxyTraps::{getPrototype, setPrototype, setImmutablePrototype}`
2021-07-10 12:54:31 +09:00
sagudev
fd3bbc7ec9 Fix error 2021-04-17 18:19:02 +02:00
sagudev
13095741c5 Fix for bindgen 2021-04-17 17:53:11 +02:00
sagudev
19be2cd3fa Update mozjs to 88 2021-04-14 09:20:58 +02:00
Vincent Ricard
a627dde0d0 Port some code to Python3 2021-02-18 09:35:46 -05:00
Josh Matthews
397b9b2601 Implement toStringTag symbol for DOM objects.
This symbol is now required for the expected stringification behaviour in WPT.
2021-02-18 09:35:46 -05:00
Josh Matthews
5c4939599e Update mozjs. 2021-02-18 09:35:45 -05:00
Sean Joseph
823cca30d6 Added is_platform_obj_static 2020-11-26 18:30:52 -05:00
Jonathan Kingston
0e1479cc84 Add creation url and Secure Contexts 2020-11-25 18:30:50 +00:00
Sudarsan
f8c9ee4eff Update mozjs to 0.14.1
This update pulls in improvements on mozjs that now removes the need to
pass pointers to CompileOptionsWraper::new(), allows NewProxyObject to
now accept a Singleton bool and JSClass and removes an unsafe
Handle::new usage.
2020-08-28 20:54:18 +08:00
Josh Matthews
63528f6fdf dom: Generate iterator symbol for interfaces with indexed getters. 2020-07-09 23:22:48 -04:00
Josh Matthews
aa80f91399 dom: Use pref macro for IDL conditional guards. 2020-07-09 23:22:48 -04:00
Kagami Sascha Rosylight
2a2e037a4d Fix incorrect string joining 2020-06-21 05:42:42 +02:00
Kagami Sascha Rosylight
d01648d637 Fix remaining flake8 warnings 2020-06-21 03:34:32 +02:00
Josh Matthews
edf86d1bdc dom: Convert parent dictionary values when converting dictionaries to JS. 2020-06-16 17:34:30 -04:00
Simon Sapin
57d89675b0 Use atomic pointers instead of static mut for DOM proxy handlers 2020-06-05 00:11:37 +02:00
Simon Sapin
3367db6067 Keep DOM proxy handlers as separate named items rather than in one array 2020-06-05 00:11:37 +02:00
Gregory Terzian
bd5796c90b integrate readablestream with fetch and blob 2020-06-04 11:38:35 +08:00
bors-servo
7758d4ff62
Auto merge of #25432 - warren-fisher:HTMLConstructor, r=jdm
Extract some of CGClassConstructHook to utils.rs

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

Moving some of the functionality from the massive tripled quoted string in CGClassConstructHook in `components/script/dom/bindings/codegen/CodegenRust.py` to `components/script/dom/bindings/utils.rs`. Must be made unsafe because of UnwrapObjectDynamic and other functions. Added imports as necessary as well, as well as cleaning up using test-tidy.

---
<!-- 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 #25395 (GitHub issue number if applicable)

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-06-03 16:59:32 -04:00
Warren Fisher
2da07ed164 Reduce code duplication. Move some of CodegenRust.py to htmlconstructor.rs 2020-06-03 15:13:34 -04:00
Kunal Mohan
d9db350df5 Improve webidl precision
Allow enum variants staring with digit
2020-06-01 19:24:34 +05:30
Kunal Mohan
f014f15d4e Allow sequence of nullable dictionary items in webidl
of type "sequence<Dict?> x"
2020-05-30 11:01:13 +05:30
bors-servo
1a61937031
Auto merge of #26718 - jdm:codegen-sequence, r=Manishearth
Improve precision of sequence types for WebIDL codegen.

Unlike #26699, this doesn't attempt to improve any of the resulting types and only maintains the status quo.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes
2020-05-29 22:10:21 -04:00
Josh Matthews
c4f8167b6f dom: Improve precision of sequence types for WebIDL codegen. 2020-05-29 15:16:55 -04:00
Simon Sapin
d103e06ba9 Use dynamic dispatch in mozjs::panic::wrap_panic
Pick up https://github.com/servo/rust-mozjs/pull/512

Fixes https://github.com/servo/servo/issues/26585

This diff is best viewed with "ignore whitespace changes", because of indentation change.
2020-05-25 20:34:05 +02:00
Simon Sapin
6175a68c10 Replace a transmute with .to_ne_bytes() + constructor 2020-04-15 17:54:04 +02:00
bors-servo
3abbfdf278
Auto merge of #26170 - Manishearth:enum-convertible, r=asajeffrey
Add FromJSValConvertible for enums

Fixes https://github.com/servo/servo/issues/26169

This adds FromJSValConvertible implementations for webidl enums, which allows them to be used within `sequence<>`, etc.

This also uses these implementations when converting arguments.
2020-04-12 11:47:43 -04:00
Manish Goregaokar
242b7f8fdc Use FromJSValConvertible impls when converting arguments 2020-04-11 00:15:43 -07:00
Manish Goregaokar
10a13ffa20 Implement FromJSValConvertible on enums 2020-04-11 00:15:43 -07:00
Manish Goregaokar
c24481ab9c Do not filter out platform objects when doing dictionary conversions
https://heycam.github.io/webidl/#es-overloads

In step 12, the platform object check is for substep 4, but importantly it only matters if `V` implements the matching interface. If not, it should be able to fall back to substep 10 and attempt conversion to a dictionary.
2020-04-08 23:15:57 -07:00
Shinichi Morimoto
74995a5287 fixed CGCollectJSONAttributesMethod 2020-03-31 09:37:07 +09:00
Shinichi Morimoto
d8c1dc60e8 fixed is_satisfied condition 2020-03-30 02:32:46 +09:00
Shinichi Morimoto
f7d4a37f78 fixed fmt 2020-03-28 23:21:35 +09:00
Shinichi Morimoto
80b2a87be7 fixed #25281 2020-03-28 20:18:30 +09:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Anthony Ramine
3f30c7d8be Do not do weird scope things in MethodDefiner
Variable `m` comes from a previous list comprehension earlier in the
function is not actually properly defined.
2020-03-14 12:17:48 +01:00
Anthony Ramine
4930479ac8 Update the WebIDL parser
Upstream doesn't allow downloading .tar.gz archives so update.sh was changed
to use unzip.
2020-03-14 12:17:48 +01:00
Anthony Ramine
05077d31c8 Change how we reflect DOM objects in codegen
We now go through <Root<MaybeUnreflectedDom<T>>>::reflect_with,
to decrease the amount of bad stuff we can end up doing. This
avoids a source of vtable pointer instability that could cause
issues down the road.
2020-03-06 18:45:29 +01:00
Anthony Ramine
5a4f8cf93f Update SpiderMonkey 2020-03-06 11:13:28 +01:00
Anthony Ramine
14846d0567 Introduce a new type MaybeUnreflectedDom<T> (fixes #25701) 2020-02-17 10:17:47 +01:00
Kunal Mohan
5a3e1b8e69
rename compartment to realm 2020-01-24 20:52:36 +05:30
bors-servo
fdfc840bac
Auto merge of #25446 - pshaughn:fixme11868, r=jdm
Make getOwnPropertyDescriptor hold the correct value for indexed/named properties

This is towards #25036 and #25415; it could have far-reaching implications so I want to test it in isolation and see the results on the full test suite.

A few lines of code had a FIXME(#11868) despite that issue being closed, and looking for the pattern that was marked that way, I found one other unmarked instance of it. It doesn't immediately crash, and maybe it will pass some tests or fail some tests in informative ways.

EDIT: After adding an overlooked extended attribute to HTMLFormElement, this works very well indeed and seems to be worth merging!

---
<!-- 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 #25036

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-01-10 15:18:10 -05:00