Commit graph

25288 commits

Author SHA1 Message Date
bors-servo
1bb713521b
Auto merge of #29374 - jdm:get-cx-cleanup, r=mrobinson
Assert if DomObject::global is called outside of a JS realm

To avoid crashing in https://github.com/servo/servo/issues/27037, we need to progressively add `InRealm` or `AlreadyInRealm` arguments higher up in the call stack. These changes assert that DomObject::global is only called inside of a realm, which is preferable to segfaulting in the JS engine. Making this a compile-time error requires changing lots of `.global()` callsites, but this PR removes a bunch that are now unnecessary.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix (partially) #27037
- [x] There are tests for these changes
2023-05-21 04:05:58 +02:00
Josh Matthews
dcf02caf81 Enter realms when creating special same-origin iframes. 2023-05-20 18:32:08 -04:00
Fabrice Desré
0d0540fc95 Update tungstenite 2023-05-20 21:55:00 +00: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
The Capyloon Team
da9796f7e3 Fix compiler warning introduced in 4aa8a1c418 2023-05-20 02:03:58 +00: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
aea14a2470 Further changes required by Servo 2023-05-19 19:06:09 +02:00
Oriol Brufau
1cc44bd065 style: Will-change should only create stacking contexts / containing blocks / etc if the property it'd change would apply
As per https://drafts.csswg.org/css-will-change/#will-change.

> If any non-initial value of a property would cause the element to
> generate a containing block for absolutely positioned elements,
> specifying that property in will-change must cause the element to
> generate a containing block for absolutely positioned elements.

But in this case the transform property wouldn't apply to the element so
there's no reason to create a stacking-context.

Differential Revision: https://phabricator.services.mozilla.com/D114121
2023-05-19 19:06:09 +02:00
Oriol Brufau
60867bbe7e style: Remove unused NS_CHANGE_COLOR_IF_SAME_AS_BG
It was introduced in bug 1024930, but it is unused since.

Differential Revision: https://phabricator.services.mozilla.com/D114389
2023-05-19 19:06:09 +02:00
Oriol Brufau
516c7a304a style: Use saturating addition for math-depth
Differential Revision: https://phabricator.services.mozilla.com/D114070
2023-05-19 19:06:08 +02:00
Oriol Brufau
43cec05c04 style: Don't allow whitespace between media query operator delim tokens
Differential Revision: https://phabricator.services.mozilla.com/D113648
2023-05-19 19:06:08 +02:00
Oriol Brufau
fb9d8ddc73 style: Make sure to consume the flusher when we hit the cascade data cache
So that sheets are properly marked as committed. The issue is that we
have this "committed" optimization, to avoid doing work if somebody adds
and removes an stylesheet without us flushing in the meantime:

  https://searchfox.org/mozilla-central/rev/f018480dfed4fc583703a5770a6db9ab9dc0fb99/servo/components/style/stylesheet_set.rs#308-319

The "committed" bit is set when we consume the flusher (in each(..)).

However when we hit the cache, before this patch, we wouldn't consume
it, which means that we may fail to do some full rebuilds even though we
need them.

Fix it by making sure we call each() in that case.

We add a test (the test would show a red square before this patch, and a
lime square with the fix).

Differential Revision: https://phabricator.services.mozilla.com/D113206
2023-05-19 19:06:08 +02:00
Oriol Brufau
90781493fc style: Make the -moz-toolbar-prefers-color-scheme a tri-state
This will allow detecting the system theme, which allows fixing some of
the blocked bugs.

Note that when using the system theme we will still match light or dark
appropriately, so this shouldn't change behavior just yet.

Differential Revision: https://phabricator.services.mozilla.com/D113516
2023-05-19 19:06:08 +02:00
Oriol Brufau
ab445a02b0 style: Implement accent-color in nsNativeBasicTheme
This is a new addition for CSS UI Level 4:

  https://drafts.csswg.org/css-ui-4/#widget-accent

I want to provide feedback on some spec issues, and thought it was a
kinda neat thing to prototype (it also makes testing contrast and such
with random GTK themes easier).

For now enable for Nightly only.

Differential Revision: https://phabricator.services.mozilla.com/D112312
2023-05-19 19:06:08 +02:00
Oriol Brufau
373d22119f Further changes required by Servo 2023-05-19 19:06:08 +02:00
Oriol Brufau
69fc5ca9fd style: Garbage-collect event state bits
We had about 9 gaps / unused bits. I moved the devtools ones at the end
because I think we should be able to remove them (but separate bug).

Differential Revision: https://phabricator.services.mozilla.com/D113365
2023-05-19 19:06:07 +02:00
Oriol Brufau
54965bbcb9 style: Fix whitespace handling in clamp() parsing
We should just restore the state when seeing whitespace and an unknown
token like when we do when finding any other token a few lines below.

This is not an issue for most callers (it's only an issue for clamp())
because the other callers use either `parse_comma_separated()` (for
min/max), or `parse_nested_block()` (for parens / nested calc()).

Both of those functions restrict the input in such a way that
is_exhausted returns true (a few lines above) and thus we parse
successfully.

Differential Revision: https://phabricator.services.mozilla.com/D112681
2023-05-19 19:06:07 +02:00
Oriol Brufau
d12cb17d73 style: -moz-toolbar-prefers-color-scheme for dark theme detection
This adds a new @media query -moz-toolbar-prefers-color-scheme which works like
prefers-color-scheme but is set based on the browser theme rather than the OS
theme. The background colour of the toolbar is used to determine the theme
dark/light preference. This will be used for in-content common.css pages and
other UI elements that include that stylesheet in the browser-chrome through
shadow DOM.

The end result is that about: pages, infobars, and modals will now "match" the
browser theme (just light/dark mode, not LWT theming support).

Differential Revision: https://phabricator.services.mozilla.com/D111486
2023-05-19 19:06:07 +02:00
Oriol Brufau
29bca57333 Further changes required by Servo 2023-05-19 19:05:24 +02:00
bors-servo
7443ac9944
Auto merge of #29753 - michaelgrigoryan25:master, r=jdm
Update: Bump webdriver version to 0.48

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

These changes bump the `webdriver` crate from version 0.44 to 0.48. There are compilation issues which will need to be addressed accordingly.

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

<!-- Either: -->
- [X] These changes may require some additional tests

<!-- 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 21:52:39 +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
michaelgrigoryan25
4aa8a1c418 Update: Bumped webdriver version to 0.48 2023-05-18 13:48:19 +04: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
ed239931bb use response tainting::cors in cors preflight 2023-05-18 09:33:56 +02:00
Iver Småge men bærbar
5adff93054 add response tainting to request builder 2023-05-18 09:33:56 +02:00
bors-servo
c7f8a6ecb5
Auto merge of #29747 - mrobinson:workspace-dependencies, r=mukilan
Start the transition to workspace dependencies

This will ultimately make it simpler to update crate dependencies and reduce duplication 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.

<!-- 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 do not require tests because they do not change behavior.

<!-- 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 07:03:30 +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
Martin Robinson
b60e105526 Refactor Layout 2020 layout for a compositor-side scroll tree
This change refactors how layout is done in Layout 2020 in preparation
for a compositor-side scroll tree:

1. Now the SpatialId and ClipId of each fragment is stored separately.
   This will allow storing a scroll node id instead of only the handle
   to the WebRender spatial node.
2. Separate out stacking context tree construction and display list
   building. This change will make it possible to eventually build the
   stacking context tree without the full display list if we find that
   necessary. For instance, this might be useful to cache containing
   block boundaries.
3. Add a `DisplayList` struct that stores both the WebRender display
   list builder and the compositor info. This exposes the API to the
   layout thread for display list building.

In addition, this change adds a lot of missing documentation.  This
should not change behavior.
2023-05-17 10:46:27 +02:00
Oriol Brufau
773ddf31fe style: Support the type() function in image-set
Differential Revision: https://phabricator.services.mozilla.com/D109201
2023-05-17 02:12:40 +02:00
Oriol Brufau
7567ddd262 style: Hide -moz-outline-radius behind a pref
This property does nothing since bug 315209 got implemented.

Every single user that I checked was doing the same math by hand, so
hooray for good defaults :-)

Differential Revision: https://phabricator.services.mozilla.com/D112253
2023-05-17 02:12:40 +02:00
Oriol Brufau
90a2687545 style: Add a CSS error to the console when using non-featureless :host selectors
(which would never match by definition).

Differential Revision: https://phabricator.services.mozilla.com/D111610
2023-05-17 02:12:40 +02:00
Oriol Brufau
7425f2d922 style: Enable forced-colors in UA and chrome always
Differential Revision: https://phabricator.services.mozilla.com/D112069
2023-05-17 02:12:40 +02:00
Oriol Brufau
b5dcb5c961 Further changes required by Servo 2023-05-17 02:12:21 +02:00
Oriol Brufau
e23a8bf0ad style: Add attribute names to the bloom filter
Safari does this. This reduces the runtime in the example linked from
comment 0 quite a lot (40ms on a local opt build, from ~130ms on a
release nightly build).

I added a pref because there's a slight chance of performance
regressions on pages that do not use attribute selectors, as we're now
doing more unconditional work per element (adding the attributes to the
bloom filter). But the trade-off should be worth it, I think.

Differential Revision: https://phabricator.services.mozilla.com/D111689
2023-05-16 23:40:23 +02:00
Oriol Brufau
a7ca8022d3 style: [css-pseudo] Use 'white-space: pre' by default in ::marker
Differential Revision: https://phabricator.services.mozilla.com/D107359
2023-05-16 23:40:23 +02:00
Oriol Brufau
d8993eef7e Further changes required by Servo 2023-05-16 23:40:17 +02:00
Oriol Brufau
743f213c25 style: Move moz-control-character-visibility out of mako, and remove support for gecko_pref_controlled_initial_value
No behavior change, just cleanup. Actually seem this technically _adds_ some code even
though it's a cleanup, but that's mostly because of the wrapping of the
derive list.  The resulting code is simpler (more in-line with our usual
things, so I think it's an improvement).

Differential Revision: https://phabricator.services.mozilla.com/D111551
2023-05-16 23:17:16 +02:00
Oriol Brufau
fac547276f style: Remove various image-orientation related prefs
These shipped in 77.

Differential Revision: https://phabricator.services.mozilla.com/D111550
2023-05-16 23:16:24 +02:00
Oriol Brufau
693c2f0d27 style: Remove -moz-proton-infobars media query support
Differential Revision: https://phabricator.services.mozilla.com/D110963
2023-05-16 23:15:26 +02:00
Oriol Brufau
b40f4b6fec style: Clean up text-justify, and make distribute a parse-time alias
Since it's simpler, as discussed in the CSSWG issue.

Differential Revision: https://phabricator.services.mozilla.com/D111346
2023-05-16 23:14:19 +02:00
Oriol Brufau
bbc03a2577 style: Enable Proton Urlbar
Differential Revision: https://phabricator.services.mozilla.com/D110998
2023-05-16 23:13:14 +02:00
Oriol Brufau
7bb15f19f1 style: Remove dead prefers-color-scheme: no preference code
It was removed in bug 1643656.

Differential Revision: https://phabricator.services.mozilla.com/D111461
2023-05-16 23:12:19 +02:00
Oriol Brufau
3da3d76a08 style: Clean up NPAPI plugin fallback behavior
Similifies use of EventStates and ObjectType/FallbackType enums since most states they represented are no longer valid with the removal of NPAPI plugins.  The state machine for (unsupported) plugin elements is now much simpler but still distinguishes between HTML fallbacks, fallbacks leading to a "BROKEN" state (e.g. failing to load the image the element refers to), and fallbacks that would simply lead the element to occupy an empty region.  The last type of fallback is behind a pref "layout.use-plugin-fallback" and is disabled by default.

Simplifying the state machine allows us to clean up nsObjectLoadingContent.  We also update many of the enums which refered to plugins, which would otherwise get confusing.

Differential Revision: https://phabricator.services.mozilla.com/D107158
2023-05-16 23:03:45 +02:00