Commit graph

8916 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
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
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
Josh Matthews
dcf02caf81 Enter realms when creating special same-origin iframes. 2023-05-20 18:32:08 -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
Oriol Brufau
60e206143c Further changes required by Servo 2023-05-16 13:00:18 +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
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
Martin Robinson
edeb24b30f Fix scrolling on root element
eca0acf459 uncovered a bug in the way that
the scrolling area of `window` was calculated and broke scrolling on the
root element. This change does two things in order to fix that:

1. Does a partial revert of eca0acf459 in
   order to get scrolling from script working again on the window
   object.
2. Has the compositor always generate a frame for scrolls starting from
   script and waits for them. This is speculative fix for flakiness in
   root scrolling tests on CI.
2023-05-05 12:42:02 +02:00
switchpiggy
7c61c5b930 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 02:05:02 -07:00
switchpiggy
bf49260e81 Implemented special cases for Element.clientWidth() and clientHeight() 2023-05-04 23:03:36 -07:00
bors-servo
a8f7c45811
Auto merge of #29693 - mrobinson:cleanup-options, r=mukilan
Clean up how command-line options are passed around

<!-- 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 #29678
- [x] These changes do not require tests because they do not change behavior.
2023-05-03 10:44:48 +02:00
Martin Robinson
17e3f34e65 Fix flakiness in animation tests
1. When updating the animation timeline, ensure that nodes that are
   animating are marked dirty, if necessary, so any style queries will
   force an layout flush.
2. Disable the problematic transition test suites, as they are in Gecko.
   These suites often fail when Servo is so overloaded that it cannot
   deliver frames fast enough to get more than two samples during the
   animation lifecycle.

Fixes #28334.
Fixes #26435.
Fixes #21486.
2023-05-02 08:37:15 +02:00
Martin Robinson
dc192172ad Clean up debug options 2023-05-01 14:09:28 +02:00
cybai
7c9c786053 Reset to in-memory stream with empty byte sequence for None init body
Because the response body stream is initialized with FetchResponse, it
cannot be processed with in-memory empty sequence. Thus, instead of
using the FetchResponse stream, we'll reset it to Memory body stream
with empty byte sequence if there's no init body.
2023-04-27 14:18:36 +09:00
AnthonyJ3
6907f6be3e fixup! defaulted credentials mode to same-origin & removed fallback credentials 2023-04-25 19:01:49 -04:00
Martin Robinson
eca0acf459 Allow script to scroll overflow: scroll elements
Before the code was only allowing `overflow: hidden` elements to scroll.
This fixes that issue and also clean up the code that deals with
detecting whether the body is a "potentially scrollable" in quirks mode.
2023-04-25 21:25:00 +02:00
Martin Robinson
3ab5e2a188 Scroll from script should trigger a reflow
Scrolling from script should flow layout and send a display list to
WebRender. This allows all of the scroll nodes to exist in WebRender
before asking it to move the node.

See https://gist.github.com/paulirish/5d52fb081b3570c81e3a.
Fixes #29659.
2023-04-25 21:25:00 +02:00
bors-servo
c44c6e8c11
Auto merge of #29646 - CYBAI:fix-classname-filter, r=jdm
Fix checking for empty set in getElementsByClassName

Because empty set with `.all(predicate)` will always return `true`, it will result in always filtering wrong elements when the classes is empty set.

Thus, we return earlier with `always_empty` HTMLCollection in the empty classes case so that we can avoid filtering on empty sets.

With adding the checking, we can fix the failures in `/dom/nodes/getElementsByClassName-empty-set.html`.

---

- [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)
- [x] There are tests for these changes
2023-04-24 07:55:25 +02:00