Add support for temporary storage via a new config option
`temporary_storage`
and a corresponding command-line argument `--temporary-storage`.
When enabled, client storage uses a storage directory
(e.g. `clientstorage/temporary/<uuid>`) instead of the shared default
location.
This can be used to provide isolation between concurrent servo
instances.
This is especially useful for WPT runs, where multiple Servo instances
may
execute in parallel and would otherwise share the same storage, leading
to
cross-test interference.
Based on that, this PR also updates the WPT runner to enable temporary
storage
by default.
Testing: Manual testing and a full try run.
Signed-off-by: Jan Varga <jvarga@igalia.com>
Add the Storage Standard WebIDL for NavigatorStorage and StorageManager,
wire navigator.storage on Window and Worker, and implement persisted(),
persist(), and estimate().
Testing: covered by WP test.
part of #39100fixes#39101
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
The macro `impl_from_pref!` would cause panic in this case.
Testing: Add more test cases to existing UT.
Fixes: #44078
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This option controls whether progressive web metrics are printed to the
system console, which is essentially the purpose of
`DiagnosticsLogging`. This makes the API a bit more uniform.
Testing: We do not really have automated testing for this kind of
feature of the API.
Fixes: This is part of #34967.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This setting is used to control whether or not incremental legacy layout
was enabled. Nowadays incremental layout is always enabled as it is a
fundamental feature of how layout works. The setting also controls
whether or not nodes are traversed in Style, but that's also something
that's much less interesting today. This change just removes this
setting as it just controls the Stylo setting. A corresponding change in
Stylo will also remove the setting there.
Testing: This just removes a setting so existing tests should suffice.
Fixes: This is part of #34967.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This concept does not need to be exposed to `Opts` any longer as it just
controls how servoshell uses the `WebView` API.
Testing: A successful compilation is enough here as this is just moving
an option.
Fixes: This is part of #34967.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Fixed a typo in the comment documentation in
`ports/servoshell/prefs.rs`. Changed "arugment" to "argument" on line
291.
Testing: This change does not need testing because it just fixes a typo
in a rustdoc comment.
Signed-off-by: hobostay <110hqc@gmail.com>
That way, we correctly run it whenever we invoke WPT. This is relevant
for wpt.fyi, where currently we are not seeing any test coverage in the
`/editing` tests. To make tracking of progress possible, it should be
defined in prefs, not in the `.ini` configuration.
Part of #25005
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Previously we listened to 0.0.0.0. which means any connection coming to
a specific port. That seems a bit ill advised as not everybody has a
good firewall setup. Now we default listen only on 127.0.0.1 but
optionally can describe a full SocketAddr such as "192.168.1.23:1234".
Side note: Cleaned up the ipc-channel syntax.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Testing: Currently we don't have an automatic way to test this. Manually
run devtools and it connects.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
With keep-alive requests implemented, this feature is now fully working.
Some tests still fail on
header parsing, which is #36801Fixes#38302
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Replace `allow` with `expect` lints for `unused`, `unsafe_code`,
`dead_code`, and `non_upper_case_globals`.
Testing: So far just check it compiled on `x86_64-linux` on NixOS. Need
to use the module `system.fontconfig.enable = true;` I think in my NixOS
config.
Part of: #40383
Searching `allow\(.*\)` for `.rs` files shows the following. for
(total_results:total_files) went from `707:386` to `675:368`, a
reduction of `32:18`.
How many files is too many files per PR? I feel like the 20-30 I have is
too big.
---------
Signed-off-by: Wayne Van Son <waynevanson@gmail.com>
- The helper method now accepts args without the binary name. This
allows us to remove the injection of servo / servoshell in the tests and
on android / ohos.
- Allow parsing str slices, instead of requiring Vec<String>. This
allows removing unnecessary conversions / allocations.
Testing: Covered by existing unit, integration and wpt tests, which pass
commandline arguments.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
On ohos/android the early redirect from stderr/stdout is not yet setup
when we parse commandline arguments.
This redirects these error on the standard logging facilities.
Testing: Tested on OHOS device with correct and incorrect arguments and
on linux desktop.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Changed some allow to expects and removed the unfulfilled expectations.
Testing: Refactor
Part of: #40383
Signed-off-by: anonmiraj <nabilmalek48@gmail.com>
With this change can now configure diagnostic logging via the
`SERVO_DIAGNOSTICS` environment variable in addition to the existing -Z
command-line flag.
The environment variable accepts the same comma-separated options as -Z
(e.g., `SERVO_DIAGNOSTICS=style-tree,display-list`). The help option
works from both sources and will display all available diagnostic flags.
Environment variable parsing is disabled in production builds
Testing: Tested locally for release, debug and production build to make
sure it is disabled for production
Fixes: Part of https://github.com/servo/servo/issues/40863
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
This change finishes adding support for opening new windows in the
desktop version of servoshell. A new button is added to the tab bar
which opens a new window (this can be adjusted later, if necessary).
User interface commands now need to be processed in the context of the
`App` as we need access to a reference to the `ActiveEventLoop` to
create a new window.
Testing: servoshell is mainly untested, though a future change will add
new
unit tests for multi-window functionality.
Fixes: #13997.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
In this PR, we rename `DebugOpts` to `DiagnosticsLogging`, add some
documentation and rename variables to get rid of dump terminology.
Testing:
Fixes: part of https://github.com/servo/servo/issues/40863
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
This change makes it easier for embedders to embed the types that they
need by exporting almost everything necessary to use Servo at the root
of libservo, apart from a few exceptions. In addition, the `Servo` is
moved
to its own file so that public exports can be more easily spotted from
`components/servo/lib.rs`.
Testing: This should not change behavior and is thus covered by existing
tests.
Fixes: #18475.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The unwrap would have never been hit, but
we can remove it so lets do that.
Also fixed some typos in surrounding code.
Testing: No behavior change, covered by existing tests
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
`UIEvent.which` was implemented in #40109 and is enabled by default, we
don't need it to be listed in the experimental features.
Testing: No change of behavior.
Signed-off-by: Manuel Rego Casasnovas <rego@igalia.com>
This implements the web-facing API's behind a flag, where we further
design the embedding API in a
follow-up PR.
It passes all relevant WPT tests, since the HTML
specification leaves it up to user agents to
determine when to process these protocol handlers.
It also uses `once_cell` to lazily construct the
regex, which is what the CSP crate also uses for
its regexes [1].
Part of #40615
[1]:
db8f2e97fe/src/lib.rs (L1550-L1569)
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
In order to support multiple WebRender instances in the renderer, we
need the ability for the renderer itself to manage their creation and
destruction. This change moves the initialization of the (currently)
single WebRender instances to the renderer initialization.
Testing: This should not change behavior, so is covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Make the engine default to enabling the AbortController implementation.
Testing: No behaviour change to tests, just flipping defaults.
Fixes: #34866
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This improves the servoshell CI help messaging.
Notice that spaces in front of comments are of importance in bpaf.
The output is probably not ideal yet but it should be way better.
Testing: Compiled and looked at the output.
Fixes: https://github.com/servo/servo/issues/39312
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This override is meant to force reftests to always run with a device
pixel ratio of 1.0. Reftests are always run in headless mode which uses
a device pixel ratio of 1.0 regardless (unless you override it).
Removing this particular override allows taking screenshots in the
system DPI when taking them in headed mode, which is actually a bit
useful.
Testing: A test verifying the old behavior is removed. This causes
`/css/pixel_snapping_position_a.html` to start passing.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This change adds a new API to the `WebView` for capturing screenshots.
This makes it possible to:
- use the reftest waiting infrastructure via the API
easily.
- take more than a single screenshot in one Servo run.
- take screenshots, but still paint the `WebView` normally prior
to the moment that the screenshot is ready, instead of preventing
all non-screenshot-ready paints while taking a screenshot.
In addition, the previous infrastructure, the `wait_for_stable_image`
option is removed completely.
Testing: This change is tested by the passing of the WPT tests,
as they commonly use the screenshot feature.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
This way we have full coverage on WPT rather than the
specific folders with tests.
Part of #34866
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This change removes the `DebugOption` (`-Z`) for touch event simulation
and moves the implementation of the feature to servoshell. The resaoning
for this is:
- This is really a servoshell feature and can be implemented on top of
the API. This moves more code out of the already too-complicated
renderer.
- I would like to consolidate `DebugOptions` into a `ServoLogOptions`
to collect all options for configuring Servo logging. This requires
moving away all of the non-logging options.
- Eventually touch event simulation will be able to reuse the fling
implementation from servoshell as we are actually simulating touch
events sent to the `WebView`.
Testing: This changes a conditional feature that's used for manual
debugging.
It is difficult to write tests for this as there are no servoshell tests
that
verify input handling.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This changes removes the integration with Instruments.app "Points of
Interest" track for a variety of reasons:
- This functionality is made somewhat redundant by Servo's support for
Perfetto traces.
- This functionality depends on the `signpost` crate which hasn't seen
activity for 9 years and only supports macOS.
Testing: This removes some functionality that is only observable via
Instruments.app, so testing it is difficult.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The command-line help output for `-Z` and `DebugOptions were out of sync
again. This change makes sure they match again.
Testing: No tests necessary as this mainly just updates the help output.
Fixes: #39311
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This option is supported via the WebView API now and you can enable it
in servoshell by pressing `Ctrl` + `F12`. The command-line argument and
`Opts` field are older and I believe are no longer necessary.
Testing: This just removes a redundant command-line option, so no tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This is currently unused, so it can be removed.
Testing: This just removes an unused field, so does not require tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
When passing an invalid resolution string (such as `1x1x1`) to the
`--screen-size` or `--window-size` argument, Servo starts without any
error. Additionally, if the width or height is set to 0, Servo crashes
with a SIGSEGV (Address boundary error).
This patch addresses the following issue by several changes:
1. Introduce a custom error type ParseResolutionError.
2. Replace the `split()` method with `split_once()`.
3. Make the capital 'X' an acceptable separator.
4. Add a check to prevent crashes when width or height is set to 0.
---
Before:
```
╰─❯ ./servo --screen-size=0
index out of bounds: the len is 1 but the index is 1 (thread main, at ports/servoshell/prefs.rs:236)
fish: Job 1, './servo --screen-size=0' terminated by signal SIGSEGV (Address boundary error)
```
```
╰─❯ ./servo --screen-size=0x1
xdg_surface#30: error -1: invalid window geometry size (0x1)
assertion `left != right` failed
left: 0
right: 0 (thread main, at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/surfman-0.10.0/src/platform/unix/wayland/connection.rs:140)
fish: Job 1, './servo --screen-size=0x1' terminated by signal SIGSEGV (Address boundary error)
```
After:
```
╰─❯ ./servo --screen-size=0
Error: couldn't parse `0`: invalid resolution format
```
```
╰─❯ ./servo --screen-size=0x1
Error: couldn't parse `0x1`: width and height must be greater than 0
```
Signed-off-by: Integral <integral@member.fsf.org>
Everything related to Trusted Types has been implemented. Failing WPT
tests are related to other features such as SVG scripts.
Fixes#36258
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This includes some small refactoring and some small breaking changes as
listed below. Other than these I tried to keep the functionality exactly
the same but because in the old code the parsing and settings of
preferences was intermingled it was difficult to figure out.
Small Breaking:
- Size and resources-path were unused but appeared in the help.
- soft-fail and hard-fail: Soft-fail flag got removed because it is too
difficult to keep both. The default is now soft-fail and hard-fail can
be enabled.
- The help strings are obviously formatted differently now.
- -V does not work anymore but -v and --version.
Ideally, we want to have the ServoShellPreferences and Preferences be
directly the Argument structure but that needs a bit more discussion
because it would break backwards compatibility with the commandline.
This increases the binary size by ~280kb.
Testing: The testcases are still working but they do not cover much.
I added a unit test for the -p flag because it is the most difficult to
parse in general.
Fixes: This will fix a small number of various parsing misshaps. It will
also show if we are removing an option via unused lint.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>