Commit graph

46374 commits

Author SHA1 Message Date
Martin Robinson
78c7011240
Make native-bluetooth a default feature (#30097)
This features is turned on unconditionally by `./mach build`.
2023-08-14 14:44:47 +00:00
Martin Robinson
1d79f5dad2
Make the --release/--dev more consistent and less surprising (#30091)
There were some issues with the way that the `--release` and `--dev`
arguments were handled in mach commands.

 - Not all commands accepted them in the same way. For instance `./mach
   test-wpt` didn't really accept them at all.
 - If you did not pass either of them, mach would try to guess which
   build you meant. This guess was often quite surprising as it wasn't
   printed and it depended on the state of the your target directory,
   which is difficult to remember.
 - The `dev` profile is colloquially called a "debug" profile and some
   commands accepted `-d` or `--debug...` like arguments, but `--debug`
   with `./mach run` meant run in a debugger. It was easy to mix this
   up.

This change:

 - Centralizes where build type argument processing happens. Now it the
   same shared decorator in CommandBase.
 - Uses a `BuildType` enum instead of passing around two different
   booleans. This reduces the error checking for situations where both
   are true.
 - Be much less clever about guessing what build to use. Now if you
   don't specify a build type, `--dev` is chosen. I think this behavior
   matches cargo.
 - Makes it so that `./mach test-wpt` accepts the exact same arguments
   and has the same behavior as other commands. In addition, the suite
   correct for `test-wpt` is removed. There are only two suites now and
   it's quite unlikely that people will confuse WPT tests for rust unit
   tests.
2023-08-14 10:21:29 +00:00
Servo WPT Sync
cc86854c4e
Update web-platform-tests to revision b'785ef6ac7190e22df4a4d8a664022abcd0bb752c' (#30095) 2023-08-13 04:53:29 +00:00
Oriol Brufau
235efb85e5
Remove unused import (#30093) 2023-08-11 19:27:38 +00:00
Samson
efa38401c6
Support mac wpt builds (#29867)
* Add wpt-mac builds

* Fix wpt reporting check run tag

* There can only be five concurrent mac runners
2023-08-11 17:26:15 +00:00
Martin Robinson
c46631a1ce
Remove dependency on surfman-chains (#30090)
This functionality is now part of surfman itself.
2023-08-11 14:24:10 +00:00
Martin Robinson
59f5414ca8
Split line layout into two phases (#30089)
In the first phase, we gather LineItems and then when we have enough to
form a line we turn them into Fragments. This will make it possible to
more simply implement `vertical-align` and `text-align: justify` because
we need to measure the different aspects of the candidate line and then
produce a Fragments.

This is a general refactor of the way that inline layout works, so comes
with some progressions. In addition there are some new failures.

New failures:

Some tests are now failing because only the test or reference is getting
proper line height when it wasn't before. These should be fixed in a
followup change that properly calculate line-height in more cases:

 - /_mozilla/css/list_style_position_a.html
 - /css/CSS2/floats/float-no-content-beside-001.html
 - /css/css-content/pseudo-element-inline-box.html
 - /css/css-flexbox/flexbox_flex-none-wrappable-content.html

Some tests are now failing because floats are now placed properly, but
are no longer in their inline box stacking contexts. These will be fixed
by a followup change which properly parents them:

- /css/filter-effects/filtered-inline-applies-to-float.html.ini
- /css/css-color/inline-opacity-float-child.html.ini

One test is failing due to floating point precision errors:

- /css/CSS2/floats-clear/floats-141.xht.ini

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-08-11 07:19:50 +00:00
Samson
450f8193a5
Use mozjs tracing infrastructure (#29918)
* Update mozjs

64711ec2e6 also fixes https://github.com/servo/servo/issues/30043

* Move to mozjs Traceable and introduce CustomTraceable
2023-08-10 21:46:06 +00:00
Ngo Iok Ui (Wu Yu Wei)
1f7f4cf2be
Fix viewport origin of webrender frame (#30088)
* Fix viewport origin of webrender frame

* Update documentations
2023-08-10 14:01:21 +00:00
Oriol Brufau
c264993da8
Resolve cyclic margin and padding percentages against zero (#30085)
From https://drafts.csswg.org/css-sizing-3/#min-percentage-contribution

> For the min size properties, as well as for margins and paddings
> (and gutters), a cyclic percentage is resolved against zero
> for determining intrinsic size contributions.
2023-08-10 11:38:44 +00:00
Oriol Brufau
8dceb8e412
Handle inline margins when avoiding floats (#30072) 2023-08-09 21:19:16 +00:00
Yutaro Ohno
5cfec2fbdf
docs: Fix sample command in COMMAND_LINE_ARGS doc (#30082) 2023-08-09 13:43:13 +00:00
Martin Robinson
170cd44fa4
Clean up some unused code after switching to rustls (#30081)
The SSL certificate resource is no longer used as these certificates are
loaded via the webpki-roots crate.
2023-08-09 01:02:02 +00:00
thesecretmaster
c28404e9fa
Return error when setting invalid <table> caption (#30020)
* Return error when setting invalid <table> caption

Signed-off-by: thesecretmaster <thesecretmaster@developingtechnician.com>

* Forgot to commit style changes

Signed-off-by: thesecretmaster <thesecretmaster@developingtechnician.com>

---------

Signed-off-by: thesecretmaster <thesecretmaster@developingtechnician.com>
2023-08-08 16:30:55 +00:00
Martin Robinson
bce7622cde
Switch to rustls and webpki-roots (#30025)
This change replaces OpenSSL with rustls and also the manually curated
CA certs file with webpki-roots (effectively the same thing, but as a
crate).

Generally speaking the design of the network stack is the same. Changes:

- Code around certificate overrides needed to be refactored to work with
  rustls so the various thread-safe list of certificates is refactored
  into `CertificateErrorOverrideManager`
- hyper-rustls takes care of setting ALPN protocols for HTTP requests,
  so for WebSockets this is moved to the WebSocket code.
- The safe set of cypher suites is chosen, which seem to correspond to
  the "Modern" configuration from [1]. This can be adjusted later.
- Instead of passing a string of PEM CA certificates around, an enum is
  used that includes parsed Certificates (or the default which reads
  them from webpki-roots).
- Code for starting up an SSL server for testing is cleaned up a little,
  due to the fact that the certificates need to be overriden explicitly
  now. This is due to the fact that the `webpki` crate is more stringent
  with self-signed certificates than SSL (CA certificates cannot used as
  end-entity certificates). [2]

1. https://wiki.mozilla.org/Security/Server_Side_TLS
2. https://github.com/briansmith/webpki/issues/114

Fixes #7888.
Fixes #13749.
Fixes #26835.
Fixes #29291.
2023-08-08 14:00:10 +00:00
Oriol Brufau
ab0f48f8e8
Handle BFC roots with auto width next to floats (#30057)
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-08 11:46:36 +00:00
Yutaro Ohno
e6c9ca207c
Fix failing unit test due to overflow (#30074) 2023-08-08 11:29:14 +00:00
Delan Azabani
048ca7806b
mach: fix exit status on NixOS (#30079) 2023-08-08 09:09:27 +00:00
Servo WPT Sync
2fe0413b72
Sync WPT with upstream (07-08-2023) (#30078)
* Update web-platform-tests to revision b'6d5a1f7fb272973c2a951831b4f9fb25f05f96b0'

* Revert some expectations updated by WPT import

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-08-08 04:24:47 +00:00
Oriol Brufau
1346c34083
Avoid bad calls to solve_containing_block_padding_border_and_margin_for_in_flow_box (#30073)
Avoid solve_containing_block_padding_border_and_margin_for_in_flow_box()
for a block-level box that establishes an independent formatting context
(or is replaced) in the presence of floats, since the margins and inline
size could then be incorrect.

No actual change in behavior: this patch still resolves the margins
incorrectly with solve_block_margins_for_in_flow_block_level(),
and also keeps the old logic for width:auto.

However, this refactoring prepares the terrain to address these issues
in #30072 and #30057.
2023-08-07 17:47:49 +00:00
Mukilan Thiyagarajan
cedd59361e
Pass --layout-2013 flag in 'WPT import' job (#30077)
PR #30048 switched `./mach update-wpt` to use 2020 layout engine by default.  Since the WPT import job was not passing any flags when updating 2013 expectations, it was not using the correct metadata files, leading to failures when landing the recent [wpt sync PR](https://github.com/servo/servo/pull/30075)
2023-08-07 13:40:30 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Oriol Brufau
66e0d543cf
Refactor PlacementAmongFloats (#30068)
- Add explanatory comments.
- Rename some methods.
- Store the ceiling instead of relying on the first band, this allows
  calling place() when current_bands is empty.
- Make current_bands_height() work when current_bands is empty.
- Add add_one_band() helper method.
- Make place() return a Rect. Follow-up patches will need to know the
  size of the area shrunk by floats.

This will be useful for #30057 and #30050.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-04 08:19:41 +00:00
Martin Robinson
51fa6c7e18
Checkout the PR when triggering try from PR comments (#30069)
Fixes #30067.
2023-08-04 07:06:43 +00:00
Mukilan Thiyagarajan
926cce5b86
Update ipc-channel, crossbeam-channel and other deps (#30070)
These updates will allow us to move to the latest
nightly rustc

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-08-04 06:57:19 +00:00
Mukilan Thiyagarajan
5305c507c2
Fix race condition and other issues related to Worker destruction. (#30066)
* Fix race condition in Worker destruction

During shutdown, the main script thread calls
JS_RequestInterruptCallback(cx) for each worker thread it owns
where cx is the JSContext* created for that worker.
Although JS_RequestInterruptCallback is safe to call
from threads other than the worker thread, it is possible
the JSContext* has already been destroyed

For example, as noted in #30022, since the main thread sets
the worker's `closing` flag to true to signal termination before it
calls JS_RequestInterruptCallback, we can have a race condition
where the worker exits its event loop when `closing` flags is set
and then it (worker thread) destroys its own JSContext and JSRuntime.
When the main thread resumes, it will call
JS_RequestInterruptCallback for the worker's context, leading to
a use-after-free bug.

This patch solves this issue by improving the existing
`ContextForRequestInterrupt` abstraction used for sharing the Worker's
associated JSContext* with the parent script thread.
Instead of simply wrapping a plain `*mut JSContext`, we now wrap the
`*mut JSContext` in a nullable mutex i.e Mutex<Option<*mut JSContext>>

The mutex lock needs to be held by the parent thread when it
calls JS_RequestInterruptCallback.
Similary, before the worker destroys its JSContext, it locks and
sets the Option to None, signaling that the JSContext can no longer
be used for interrupting the worker.

This patch also fixes the issue in #30052 by enforcing the use
of ContextForRequestInterrupt abstraction which ensures the correct
JSContext is used by the main thread when Worker.terminate is called.

Fixes #30022, #30052

* Fix Worker.importScripts to handle termination

Fixing #30052 uncovered this issue in the implementation
of `importScripts` method. After the fix for #30052,
the WPT test `/workers/Worker-terminate-forever-during-evaluation.html`
started to crash because when evaluation doesn't succeed
`importScripts` always returns Error::JSFailed code to the caller,
which indicates that there is a Dom/JS exception to be thrown. However,
this is not true when the script is terminated, which causes
the generated binding layer for 'importScript` to fail
the assertion that there is a pending exception.

This patch makes `importScripts` work similar to the [logic that
evaluates the top-level script][1] of the Worker - it simply prints
`evaluate_script failed - (terminated)' if the worker is terminating

[1]: 3fea90a231/components/script/dom/workerglobalscope.rs (L434)
2023-08-03 23:33:21 +00:00
Ngo Iok Ui (Wu Yu Wei)
3fea90a231
Use raw handles to create surfman context instead (#29871) 2023-08-03 10:54:30 +00:00
Oriol Brufau
d90e3078a6
Never resolve margin-left:auto to a negative amount (#30065)
With direction:ltr (and we don't support direction:rtl yet), the rules
from https://drafts.csswg.org/css2/#blockwidth imply that margin-left
shouldn't resolve auto to a negative amount.

This aligns Servo with Gecko and Blink. WebKit may resolve to a negative
amount in some cases.
2023-08-03 09:21:22 +00:00
Martin Robinson
1296ddf273
Make fewer PositioningContexts when descending (#30061)
When descending and we have the option, don't create new
PositioningContexts just to update the static position of laid out
abspos descendants. Instead, use the new PositioningContextLength to
only update the newly added hoisted abspos boxes.
2023-08-03 08:51:27 +00:00
Tuna
4c8db6af87
bump base64 from 0.10 to 0.21 (#29804)
* bump base64 from 0.10 to 0.21

* Fix configuration of bitflags

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-02 21:25:37 +00:00
Yutaro Ohno
ad0fa77456
Switch default layout option to --layout-2020 in some mach commands (#30048)
Currently, `./mach test-wpt` family of commands (`test-wpt`,
`test-wpt-android`, and `test-wpt-failure`) and `./mach update-wpt`
default to using the legacy-layout option `--layout-2013` unless
`--layout-2020` is specified.

Given that we are now using layout-2020 by default, this change updates
these commands to default to using the `--layout-2020` option instead of
`--layout-2013`.
2023-08-02 19:29:20 +00:00
Oriol Brufau
d9a38b00ff
Simplify solve_containing_block_padding_border_and_margin_for_in_flow_box() (#30060)
Just use clamp_between_extremums() to resolve the inline size, and then
only call solve_inline_margins_for_in_flow_block_level() once.

There should be no change in behavior.
2023-08-02 14:46:07 +00:00
Martin Robinson
6e84d47fd3
Fix the docs build (#30058)
Type inference was incorrectly inferring that our `check_output()`
helper was returning `str` when in reality, it returns `bytes`. This
fixes the caller that was no longer decoding those bytes and fixes the
type annotation on the function.
2023-08-02 11:02:02 +00:00
Martin Robinson
f3c7db7d0f
Set the MacOS rpath in the build script (#30054)
Use the build script to set the rpath in MacOS instead of mach. This is
another step toward allowing building servo without mach.
2023-08-01 14:46:28 +00:00
Martin Robinson
fef332f385
Make rustup a requirement and switch to rust-toolchain.toml (#30056)
This change makes rustup a requirement for building Servo with `./mach`
and switches to the newer `rust-toolchain.toml` format. The goal here is
to make mach builds more similar to non-mach builds.

- The new format allows listing the required components, removing some of
  the complexity from our mach scripts.
- This means we must raise the required version of rustup to 1.23. The
  current version is 1.26.
- We no longer wrap every call to cargo and rustc in "rustup run" calls
  as both cargo and rustc will take care of installing and using all
  necessary components specified in `rust-toolchain.toml` when run
  inside the project directory.
2023-08-01 14:44:57 +00:00
Servo WPT Sync
4061d13ba6
Update web-platform-tests to revision b'dcf353e2846063d4b9e62ec75545d0ea857ef765' (#30045) 2023-08-01 13:47:21 +00:00
Oriol Brufau
8a5d5eaf13
Minor refactoring for PlacementAmongFloats (#30055)
No difference in behavior, just these changes:
- PlacementAmongFloats::new() initializes the top of the 1st band to the
  ceiling, so that other methods can just refer to the former without
  having to floor by the later.
- In fact, the 'ceiling' field becomes unnecessary, and is removed.
- top_of_placement_for_current_bands() is renamed to current_ceiling().
- try_place_once() is reorganized to reduce indentation.
- The condition 'len() > 0' becomes '!is_empty()'.
- The 1st band is now popped in place() instead of try_place_once(),
  then it's easier to see why the loop will end.
2023-08-01 13:22:32 +00:00
Martin Robinson
6f4f237fbd
Remove lzma path workaround for MacOS (#30053)
Now that the new version of GStreamer fixes this issue, we can remove
the workarounds for this problem as well as all of the homebrew
bootstrapping logic.
2023-08-01 11:11:46 +00:00
Martin Robinson
e153bcb40b
Remove homebrew packaging (#30047)
This hasn't been updated since 2017 and homebrew installation is also
provided via a cask which downloads the latest version from the website
[^1]. I think this code is basically unused.

[^1]: 9e944ae828/Casks/servo.rb
2023-08-01 06:55:08 +00:00
Oriol Brufau
9e4377af47
Fix interaction of margins and clearance for PlacementAmongFloats (#30038)
Consumers of PlacementAmongFloats weren't handling margins properly.
They were assuming that they would either get a positive adjustment,
or zero for no-op.

However, just like the regular clearance triggered by 'clear', the
clearance added onto blocks that establish an independent FC can be
zero or negative, and the effect is different than having no clearance.
2023-07-31 21:07:24 +00:00
shanehandley
00241e84bc
Remove customised implementation of hsts headers. (#30046)
This looks to have originally been implemented due to missing functionality in the headers crate, which has since been added and released.
2023-07-31 08:53:53 +00:00
Martin Robinson
4127ffa3fc
Remove Gecko-specific Python bootstrap logic (#30041)
Servo is no longer completely vendored into Gecko. Instead parts of
Gecko are vendored into Servo. This change removes Python mach bootstrap
code that was written to accommodate the previous situation. It's no
longer necessary.
2023-07-28 13:34:23 +00:00
Atbrakhi
25e2a6dfa1
Allow enabling minibrowser from command line (#30042) 2023-07-28 13:20:44 +00:00
Martin Robinson
9fa67685f4
Remove unnecessary join()s from GitHub Actions (#30040)
`contains()` works on arrays as well as strings, so the `join` is
unnecessary when trying to detect job statuses.
2023-07-28 05:26:19 +00:00
Martin Robinson
2ecdb8f45e
Embed git hash using vergen instead of mach (#30030)
Embed the git hash into the servo binary using vergen instead of using
custom Python code in mach. The benefit here is ones less difference
between a normal cargo run and building via mach in addition to removing
a bunch of code.
2023-07-28 05:03:06 +00:00
Martin Robinson
17a5b9200d
Remove old code for out-of-date CA stores (#30031)
This code was written to handle both Python 2 (which we no longer
support) and old Windows CI machines that did not have up-to-date CA
stores. I think we can remove this now.
2023-07-27 15:26:22 +00:00
Oriol Brufau
b8c04b4bad
Floor child sizes in calculate_inline_content_size_for_block_level_boxes (#30034)
Calculating the max-content size of a block container may add the outer
max-content sizes of multiple children. The problem is that the outer
size may be negative (due to margins), producing an incorrect result.

In particular, it could happen that the max-content size was 50-25=25,
but the min-content size would just take the maximum and be 50, which
doesn't make sense.

Therefore, this patch floors the size of all children by 0. This seems
to match Blink. Firefox and WebKit don't floor in some cases, but then
the result seems suboptimal to me. Note that there is no spec for this,
see https://github.com/w3c/csswg-drafts/issues/9120 for details.
2023-07-27 14:37:21 +00:00
Oriol Brufau
77c6a61dfa
Remove ClearSide enum (#30035)
Just use Clear instead, they have the same values.
2023-07-27 09:46:15 +00:00
Martin Robinson
4d627318af
More tweaks for the try GitHub Action (#30029)
- Don't trigger try jobs when comments are deleted or edited.
- Don't report success for cancelled jobs.
2023-07-27 08:06:36 +00:00
Oriol Brufau
e38d21d33d
Run unit tests with both layout 2013 and layout 2020 (#30032)
Since #29950, unit tests were only running with the legacy layout, and
there was no way to run them for layout 2020.

This patch makes './mach test-unit' run unit tests for both.

Also doing some changes so that the layout 2020 floats.rs tests compile.
2023-07-27 05:04:55 +00:00