Commit graph

10212 commits

Author SHA1 Message Date
Martin Robinson
78464eeabc Update uuid
This is required to use the new version of gleam and update ipc-channels
without duplicating the dependency in the future.
2023-06-26 16:27:12 +02:00
Nipun Garg
41fe94244a
Refactor ServoParser Tokenizer to return TokenizerResult 2023-06-22 13:45:20 +02:00
Oriol Brufau
bc634be84a Avoid assert failure when using @import 2023-06-14 15:58:00 +02:00
Oriol Brufau
98b49f8023 Further changes required by Servo 2023-06-09 10:22:23 +02:00
Oriol Brufau
1ac55889bb Further changes required by Servo 2023-06-09 10:22:23 +02:00
Oriol Brufau
07dbd9d637 Further changes required by Servo 2023-06-09 10:22:18 +02:00
bors-servo
fd7698c3ea
Auto merge of #29805 - jdm:dom-protos, r=mrobinson
Support extending DOM classes in JS

Adds support for determining the correct prototype as part of a `new` call for non-HTML constructors. Support for HTML constructors [was added](https://github.com/servo/servo/blob/master/components/script/dom/bindings/htmlconstructor.rs#L116) as part of the custom element work, but that wasn't enough for extending other DOM objects like `EventTarget`.

This work is based on Gecko's code in https://searchfox.org/mozilla-central/rev/2d678a843ceab81e43f7ffb83212197dc10e944a/dom/bindings/BindingUtils.cpp#3667, and is split into two parts:
1) the actualy new implementation (demonstrating that extending `EventTarget` works as expected)
2) plumbing the new prototype through all of the rest of the DOM object construction code.

This ends up being more complex than the way it's done in Gecko because they have lazy DOM reflectors, so their native DOM objects can be constructed without any knowledge of a JS prototype. Servo's reflectors are eager, however, so we need to propagate prototype information into individual constructors. As a result, this was a tedious set of changes to make.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29770
- [x] There are tests for these changes
2023-06-01 05:06:09 +02:00
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
Oriol Brufau
2a11460915 Further changes required by Servo 2023-05-30 23:26:02 +02:00
Oriol Brufau
f063308e33 Further changes required by Servo 2023-05-30 23:09:43 +02:00
Josh Matthews
b14b4726ac Assert that we're constructing. 2023-05-30 11:47:47 -04:00
Josh Matthews
56a8237ef4 Throw type error when calling DOM constructor without new. 2023-05-30 10:32:33 -04:00
Josh Matthews
ce023bea24 Don't root a Realm that's used for one call. 2023-05-29 00:47:31 -04:00
Josh Matthews
0e8ac3fdac Formatting. 2023-05-28 23:54:02 -04:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Josh Matthews
d9600ff50f Support arbitrary protos when wrapping EventTarget objects. 2023-05-28 23:23:12 -04:00
Oriol Brufau
9822db5d3c Further changes required by Servo 2023-05-27 05:59:01 +02:00
Oriol Brufau
32b3cb291f Further changes required by Servo 2023-05-26 15:23:25 +02:00
bors-servo
43ebf6c82c
Auto merge of #29798 - jdm:per-interface-codegen, r=jdm
Extract bodies of generated binding helpers into common code

This is part of fixing #29770, by extracting common behaviour that [will be called](https://searchfox.org/mozilla-central/rev/2d678a843ceab81e43f7ffb83212197dc10e944a/dom/bindings/BindingUtils.cpp#3744) from new code in interface.rs.

---
- [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
2023-05-26 08:18:51 +02:00
Josh Matthews
123937a500 Formatting. 2023-05-26 01:24:47 -04:00
Josh Matthews
7d9dc458af Use an enum to pass the index value for interfaces/protos. 2023-05-26 01:21:31 -04:00
Josh Matthews
747a99d3f6 Extract bodies of DefineDOMInterface and GetProtoObject/GetConstructorObject out of generated bindings. 2023-05-26 01:02:38 -04:00
Oriol Brufau
4f0e0c888c Further changes required by Servo 2023-05-24 18:32:36 +02:00
Oriol Brufau
4df282dab7 Further changes required by Servo 2023-05-24 18:32:31 +02:00
The Capyloon Team
11b7a756e8 De-dupe phf 2023-05-23 00:53:09 +00:00
Josh Matthews
dcf02caf81 Enter realms when creating special same-origin iframes. 2023-05-20 18:32:08 -04:00
Josh Matthews
02a280dbe1 Enter realms when processing pre-sequential events. 2023-05-20 17:14:45 -04:00
Josh Matthews
864e072d5c Enter realms more consistently during the script event loop. 2023-05-20 14:30:22 -04:00
Josh Matthews
9ea1399c30 Fix formatting. 2023-05-20 11:05:10 -04:00
Josh Matthews
5e5669b945 Remove unused argument from AlreadyInRealm::assert. 2023-05-20 11:05:09 -04:00
Josh Matthews
fca5833e21 Remove global argument from Promise::new_in_current_realm. 2023-05-20 11:05:09 -04:00
Josh Matthews
f79e1e327d Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
bors-servo
2426a38a4d
Auto merge of #29748 - Loirooriol:sync, r=mrobinson
Backport several style changes from Gecko

<!-- 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: -->
- [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. -->
2023-05-19 22:49:36 +02:00
Oriol Brufau
373d22119f Further changes required by Servo 2023-05-19 19:06:08 +02:00
bors-servo
44be28900e
Auto merge of #28587 - yvt:fix-location-target, r=mrobinson
Make `Location` operate on the correct objects

This PR updates the implementation of the "[`Location`-object navigate][1]" algorithm to use the correct browsing context as the source browsing context for navigation. This affects the determination of a referrer and referrer policy and the treatment of `javascript:` URLs.

This PR also fixes the derivation of a `Location` object's [relevant `Document`][2] to match the specified behavior.

[1]: https://html.spec.whatwg.org/multipage/#location-object-navigate
[2]: https://html.spec.whatwg.org/multipage/#relevant-document

---
- [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
2023-05-18 16:33:16 +02:00
yvt
b0a99c8c67 Make Location operate on the correct objects
This PR updates the implementation of the "Location-object navigate"
algorithm to use the correct browsing context as the source browsing
context for navigation. This affects the determination of a referrer and
referrer policy and the treatment of javascript: URLs.

This PR also fixes the derivation of a Location object's relevant
Document to match the specified behavior.
2023-05-18 15:41:08 +02:00
bors-servo
afcd6c4c5f
Auto merge of #29637 - AnthonyJ3:Use-same-origin-as-default-credential-mode-for-RequestInit-fix, r=mukilan
Use same-origin as default credential mode for RequestInit fix

<!-- Please describe your changes on the following line: -->
- Updated the default credential mode from omit to same-origin as per: https://github.com/whatwg/fetch/pull/1153
- Deleted instances of fallback credentials
---

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #29633  (GitHub issue number if applicable)
- [X] There are tests for these changes
2023-05-18 14:16:45 +02:00
bors-servo
918557ad6d
Auto merge of #29752 - mrobinson:fix-29741-by-extending-request-builder, r=mukilan
Fix 29741 by extending request builder

Extend RequestBuilder to include ResponseTainting and used said functionality to set response_tainting to `::CorsTainting` in `cors_preflight_fetch()`.

---
<!-- 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 #29741
<!-- Either: -->
- [ ] 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. -->
2023-05-18 10:45:00 +02:00
Iver Småge men bærbar
5adff93054 add response tainting to request builder 2023-05-18 09:33:56 +02:00
Martin Robinson
2f4c47bfe7 Start the transition to workspace dependencies
This will ultimately make it simpler to update crate dependencies and
reduce duplicate when specifying requirements. Generally, this change
does not touch dependencies that are only used by a single crate. We
could consider moving them to workspace dependencies in the future.
2023-05-17 11:59:35 +02:00
Oriol Brufau
60e206143c Further changes required by Servo 2023-05-16 13:00:18 +02:00
Martin Robinson
72b5fcd0b6 Combine DOM-related concepts in Layout 2020 into dom.rs 2023-05-13 11:52:59 +02:00
Martin Robinson
ab4bd2a133 Remove DangerousThreadSafeLayoutNode
Remove this trait and replace it by two non-public functions on
ServoThreadSafeLayoutNode. This requires making the iterator not
generic, which simplifies things a little bit as well.
2023-05-12 08:18:31 +02:00
Oriol Brufau
ab2ba273e3 Simplify our setup for font metric queries from style
This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.
2023-05-11 21:02:15 +02:00
Veronika Bušů
e40ec79f65 Add value argument to URLSearchParams's has() and delete()
This commit should fix #29725.

Signed-off-by: Veronika Bušů <paricbat@email.cz>
2023-05-11 08:34:17 +02:00
bors-servo
419c03182f
Auto merge of #29711 - switchpiggy:sp3, r=mrobinson
Implemented special cases for Element.clientWidth() and clientHeight()

<!-- Please describe your changes on the following line: -->
Implemented the special cases for Element.clientWidth() and Element.clientHeight() as outlined in issue #29704.

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

<!-- Either: -->
- [x] These changes do not require tests because tests already exist.

<!-- 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. -->

[Specification text](https://w3c.github.io/csswg-drafts/cssom-view/#dom-element-clientwidth):
> If the element is the [root element](https://w3c.github.io/csswg-drafts/css-display-4/#root-element) and the element’s [node document](https://dom.spec.whatwg.org/#concept-node-document) is not in [quirks mode](https://dom.spec.whatwg.org/#concept-document-quirks), or if the element is [the body element](https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2) and the element’s node document is in quirks mode, return the [viewport](https://www.w3.org/TR/CSS21/visuren.html#x1) width excluding the size of a rendered scroll bar (if any).
2023-05-08 13:56:51 +02:00
bors-servo
c67d760264
Auto merge of #29703 - ohno418:update-url-constructor-steps, r=mrobinson
Update step numbers in URL constructor

<!-- Please describe your changes on the following line: -->
Two commits have been made ahead of the current implementation of
Servo's URL constructor:

- Align with a more modern IDL definition style [1]
- Add URL.canParse() [2]

Since these commits don't alter the actual behavior, this commit only
updates the step numbers and adds brief descriptions for each step.

No behavior change is expected with this commit.

[1]: ea3b75d333
[2]: ae3c28b84e

---
<!-- 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: -->
- [x] These changes do not require tests because no behavior has changed.

<!-- 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. -->
2023-05-08 09:29:40 +02:00
bors-servo
7cfdf87e77
Auto merge of #29716 - mrobinson:generic-dom-wrapper, r=jdm
Eliminate duplicate Layout DOM wrappers

There are duplicate sets of Layout DOM wrappers: one for Layout 2013 and one for Layout 2020. As part of cleaning up and simplifying the wrappers, this change parameterizes them on the specific layout data they contain. This allows them to be shared again. In addition, various small cleanups are included.

Fixes #29691.

<!-- 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 #29691
- [x] There are tests for these changes

<!-- 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. -->
2023-05-08 07:17:09 +02:00
Yutaro Ohno
3336bf6cce Update step numbers in URL constructor
Two commits have been made ahead of the current implementation of
Servo's URL constructor:

- Align with a more modern IDL definition style [1]
- Add URL.canParse() [2]

Since these commits don't alter the actual behavior, this commit only
updates the step numbers and adds brief descriptions for each step.

No behavior change is expected with this commit.

[1]: ea3b75d333
[2]: ae3c28b84e

Signed-off-by: Yutaro Ohno <yutaro.ono.418@gmail.com>
2023-05-06 16:06:03 +09:00
switchpiggy
34762d97ad fixup! Checks moved to Element::client_rect(), fixed conditions for the special cases, reconfigured Window constructor to initialize current_viewport to initial window size 2023-05-05 11:13:26 -07:00