Commit graph

313 commits

Author SHA1 Message Date
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-03 11:26:53 +00:00
Martin Robinson
6062995636
libservo: Move WebDriver messages to the embedder crate (#35602)
This is the first step toward moving the WebDriver implementation to
servoshell. This move will make it possible to start testing the
embedding API with WebDriver. See [this zulip thread][a] for more details.

While WebDriver will be able to use a lot of API commands to do what it
is doing now, there will still need to be some "cheat codes" for more
gnarly access to `ScriptThread` details. That's why we likely won't be
able to remove all WebDriver-specific messages from the API -- but maybe
they will be useful for embedders somehow.

A couple messages have to change as they depended on `script_traits`
types, particularly those that used `WindowSizeData` and `LoadData`. I
think this helps to encapsulate the WebDriver commands a bit more
though.

[a]: https://servo.zulipchat.com/#narrow/channel/437943-embedding/topic/webdriver.20as.20embedding.20api.20playgound

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-24 13:57:28 +00:00
Martin Robinson
0908a47780
libservo: Expose a single InputEvent type and pass it to script (#35430)
This change exposes a single `InputEvent` type and now there is only a
single delegate method for this `WebViewDelegate::notify_input_event`.

- Clipboard events are now handled as `EditingAction` inpute events. In
  the future this can include things like "Select All", etc.

In addition, many parts of the dance to pass these events can now be
simplified due to this abstraction.

- All forwarded events are handled the same way in the `Constellation`,
  though they may carry an optional hit test (for events that have a
  `point`) which affects which `Pipeline` they are sent to.
- In the `ScriptThread` we now accept these `InputEvents` and use them
  everywhere. Now all "compositor events" are "input events".
- This allows removing several data structures which are no longer
  necessary.
- We no longer inform the embedder when an event was handled by a
  WebView as that was only important for a MDI feature that will
  no longer be so important the full-featured `WebView` API.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-12 17:07:15 +00:00
Shubham Gupta
1e164738d8
Add support for Upgrade request to a potentially trustworthy URL. (#34986)
* Add support for Upgrade request to a potentially trustworthy URL.

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>

* script: Support inheritable insecure request policy in documents and workers.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-02-05 12:49:56 +00:00
Delan Azabani
5e9de2cb61
Include WebViewId into EmbedderMsg variants where possible (#35211)
`EmbedderMsg` was previously paired with an implicit
`Option<WebViewId>`, even though almost all variants were either always
`Some` or always `None`, depending on whether there was a `WebView
involved.

This patch adds the `WebViewId` to as many `EmbedderMsg` variants as
possible, so we can call their associated `WebView` delegate methods
without needing to check and unwrap the `Option`. In many cases, this
required more changes to plumb through the `WebViewId`.

Notably, all `Request`s now explicitly need a `WebView` or not, in order
to ensure that it is passed when appropriate.

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-01-30 11:15:35 +00:00
Martin Robinson
a1cf0cbf86
libservo: Stop using script_traits in the embedding layer (#35185)
Many types used directly in the `libservo` API are in the
`script_traits` crate, which was created to break circular dependencies.
Move all API exposed types to `embedder_traits` which now contains types
exposed via the `libservo` embedding API. Also expose these at the root
of the `libservo` `servo` crate so that the API won't break when they
move around in the future.

The idea with `embedder_traits` in the future is that it contains types
that are available throughout servo because they are used in the
embedding API and thus should have minimal dependencies on other Servo
crates (a bit like `base`).

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-28 11:15:36 +00:00
Josh Matthews
5140ce81f0
webdriver: Serialize JS int values as i32. (#34997)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-15 08:15:37 +00:00
Martin Robinson
0e616e0c5d
api: Flatten and simplify Servo preferences (#34966)
Flatten and simplify Servo's preferences code. In addition, have both
preferences and options passed in as arguments to `Servo::new()` and
make sure not to use the globally set preferences in `servoshell` (as
much as possible now).

Instead of a complex procedural macro to generate preferences, just
expose a very simple derive macro that adds string based getters and
setters.

- All command-line parsing is moved to servoshell.
- There is no longer the concept of a missing preference.
- Preferences no longer have to be part of the resources bundle because
  they now have reasonable default values.
- servoshell specific preferences are no longer part of the preferences
  exposed by the Servo API.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 13:54:06 +00:00
Josh Matthews
90b41259d2
Various servodriver improvements (#34957)
* Make command line arguments match between servo and servodriver harnesses.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Ensure stylo preferences are updated when modifying pref values.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add a manual delay when launching servodriver to allow attaching a debugger.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-14 05:04:46 +00:00
Josh Matthews
76e0a1872b
Update all network-related dependencies to the latest versions (#34630)
* Update all network-related dependencies to the latest versions:
* rustls
* hyper
* http
* headers
* tungstenite
* async-tungstenite

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Fix panics with 1xx responses in WPT tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Use reported response length when calculating available ranges.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Remove unreachable match arm.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Clean up commented fragments in blob and file handlers.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Remove unreachable match arm.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Fix clippy warning.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Cleanup.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Fix up unit tests for dependency upgrades.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Update aws-lc-sys to fix Windows builds.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* net: Use ring instead of aws-lc-sys.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* embedding: Require embedder to initialize a rustls CryptoProvider.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Disable aws-lc-rs pending OhOS build fixes.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-08 05:47:58 +00:00
Josh Matthews
17e2ca3f01
Various servodriver fixes (#34871)
* servodriver: Set initial URL to data:, instead of about:blank.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Ignore failed epoch update messages.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Make servo-max-session-history.html use an iframe.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-07 08:57:14 +00:00
webbeef
dd9164f49a
Update webdriver to 0.51 (#34838)
Signed-off-by: webbeef <me@webbeef.org>
2025-01-05 21:16:11 +00:00
Martin Robinson
621ddd749c
Elide lifetimes where possible after rustup (#34824)
The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.

Fixes #34804.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-03 18:54:44 +00:00
Nico Burns
deb819f233
Upgrade rustc to 1.83 (#34793)
* Upgrade rustc to 1.83

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix crown (change copied from linked clippy function)

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix named lifetime lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Bump shell.nix

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix non-local impl warnings

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Format with 1.83 formatting changes

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix manual non-local impl

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More fixes for crown

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix tidy

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_return lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix doc comment lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix missing wait lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow needless_lifetimes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* more doc comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More needless_returns

Signed-off-by: Nico Burns <nico@nicoburns.com>

* is_empty lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_lifetime lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fix div_ceil lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-minimal bool

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Non-local impl in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Missing wait in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fmt

Signed-off-by: Nico Burns <nico@nicoburns.com>

* remove useless lints table

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fixup comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-local definition in sandboxing code to simplify feature flagging

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Remove wait calls and allow zombie_processes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-01-01 09:38:28 +00:00
Josh Matthews
7b160700d0
Allow running testharness/testdriver/reftests in servodriver (#34550)
* Make servodriver a thin wrapper over the base webdriver browser/executor classes.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Make ServoWebDriverRefTestExecutor a thin shell over the webdriver reftest executor.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Wait for the initial load to complete when opening a new tab via webdriver.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove assumption of a single tab from the webdriver server.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Serialize all keys of JS objects when converting to webdriver values.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Cleanup, docs, etc.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Use webview terminology more consistently.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix flake8 errors.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-12-11 19:18:44 +00:00
shanehandley
975e2ae859
Remove referrer policy from document (#34263)
* Remove the referrer policy from document and rely on its policy container

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Make ReferrerPolicy non-optional, instead using a new enum value to represent the empty string case

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix clippy issue

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix usage of Option<ReferrerPolicy> in unit test

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-11-19 12:45:10 +00:00
Martin Robinson
aa0029c11c
Add rust-version to all Cargo.toml files (#33483)
This is another step preparing for building Servo without `mach`.

Fixes #33430.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-17 16:39:07 +00:00
Martin Robinson
b6f1e3b22d
dependencies: Upgrade cookie and rename Servo's Cookie to ServoCookie (#32861)
This changes updates to the new version of the `cookie` crate in Servo
which no longer uses the old `time@0.1` data types. This requires using
a new version of `time` while we transition off of the old one. This is
the first step in that process.

In addition, the overloading of the `cookie::Cookie` name was causing a
great deal of confusion, so I've renamed the Servo wrapper to
`ServoCookie` like we do with `ServoUrl`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-26 16:13:39 +00:00
Martin Robinson
4a7f3bac7c
Use workspace definitions for all crates and update to the 2021 edition (#32544) 2024-06-18 09:22:08 +00:00
Martin Robinson
3398fc017b
Move non-gfx things out of gfx_traits and create a base crate (#32296)
For a long time, `gfx_traits` has held a lot of things unrelated to graphics
and also unrelated to the `gfx` crate (which is mostly about fonts).
This is a cleanup which does a few things:

1. Move non `gfx` crate things out of `gfx_traits`. This is important in
   order to prevent dependency cycles with a different integration between
   layout, script, and fonts.
2. Rename the `msg` crate to `base`. It didn't really contain anything
   to do with messages and instead mostly holds ids, which are used
   across many different crates in Servo. This new crate will hold the
   *rare* data types that are widely used.

Details:

 - All BackgroundHangMonitor-related things from base to a new
   `background_hang_monitor_api` crate.
 - Moved `TraversalDirection` to `script_traits`
 - Moved `Epoch`-related things from `gfx_traits` to `base`.
 - Moved `PrintTree` to base. This should be widely useful in Servo.
 - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it
   to `WebRenderFontApi`.
2024-05-17 12:28:58 +00:00
eri
cc082efbfd
clippy: Allow too_many_arguments for existing functions (#31974)
* Allow `too_many_arguments` for existing functions

* fix: Surround ASCII with code block in rustdoc
2024-04-02 12:50:45 +00:00
eri
03d64d0675
clippy: Fix assorted warnings in components/ (#31628)
* clippy: fix assorted warnings in `components/`

* fix: new and default

* fix: review comments
2024-03-13 08:31:58 +00:00
Martin Robinson
5574492505
deps: Remove unused crate dependencies (#31185)
These were identified with `cargo-marchete`.
2024-01-26 23:18:26 +00:00
Martin Robinson
f4d3af296c Move *_traits and other shared types to shared
This is the start of the organization of types that are in their own
crates in order to break dependency cycles between other crates. The
idea here is that putting these packages into their own directory is the
first step toward cleaning them up. They have grown organically and it
is difficult to explain to new folks where to put new shared types. Many
of these crates contain more than traits or don't contain traits at all.

Notably, `script_traits` isn't touched because it is vendored from
Gecko. Eventually this will move to `third_party`.
2023-11-03 15:38:18 +00:00
Ngo Iok Ui (Wu Yu Wei)
38a325cc1c
Add shell.background-color.rgba to prefs (#30488)
* Add shell.transparent-background.enabled to prefs

* Rename config to background_color

* Rename to background-color and.rgba add PrefValue::Array variant
2023-10-04 13:16:16 +00:00
Fabrice Desré
38c91b836a
Dedupe ron and base64 (#30415) 2023-09-23 11:30:57 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Delan Azabani
b256a72448
[NFC] compositing: extract types into new compositing_traits crate (#30125)
* [NFC] compositing: extract types into new compositing_traits crate

* [NFC] compositing: move InitialCompositorState back to compositing

* [NFC] compositing: rename Msg to CompositorMsg

* [NFC] compositing: revert changes to Cargo.toml features section

* [NFC] compositing: merge imports
2023-08-18 11:37:04 +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
The Capyloon Team
da9796f7e3 Fix compiler warning introduced in 4aa8a1c418 2023-05-20 02:03:58 +00:00
michaelgrigoryan25
4aa8a1c418 Update: Bumped webdriver version to 0.48 2023-05-18 13:48:19 +04: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
423cc34cb0 Bump euclid to 0.22
- Also updates raqote to latest with an upgrade of font-kit to 0.11
  applied on as a patch
- Update lyon_geom to the latest version

Major change:

- All matrices are now stored in row major order. This means that
  parameters to rotation functions no longer should be negated.
- `post_...()` functions are now named `then()`. `pre_transform()` is removed,
  so `then()` is used and the order of operations changed.
2023-01-26 08:59:21 +01:00
Josh Matthews
0625ab92b8 Update cookie/hyper_serde. 2022-04-01 02:11:51 -04:00
Josh Matthews
369a5c0370 Update image/png. 2022-04-01 02:07:17 -04:00
Josh Matthews
471650ba90 Update keyboard-types. 2022-04-01 00:35:22 -04:00
Naveen Gattu
a48a111cee Upgrade Hyper 2022-01-16 09:34:17 -08:00
yvt
41b3726271 feat: shorten thread names
The Linux kernel imposes a 15-byte limit on thread names[1]. This means
information that does not fit in this limit, e.g., the pipeline ID of
layout and script threads, is lost in a debugger and profiler (see the
first column of the table below).

This commit shortens the thread names used in Servo to maximize the
amount of information conveyed. It also rectifies some inconsistencies
in the names.

|       Before      |       After       |
|-------------------|-------------------|
| `BluetoothThread` | `Bluetooth`       |
| `CanvasThread`    | `Canvas`          |
| `display alert d` | `AlertDialog`     |
| `FontCacheThread` | `FontCache`       |
| `GLPlayerThread`  | `GLPlayer`        |
| `HTML Parser`     | `Parse:www.examp` |
| `LayoutThread Pi` | `Layout(1,1)`     |
| `Memory profiler` | `MemoryProfiler`  |
| `Memory profiler` | `MemoryProfTimer` |
| `OfflineAudioCon` | `OfflineACResolv` |
| `PullTimelineMar` | `PullTimelineDat` |
| `ScriptThread Pi` | `Script(1,1)`     |
| `WebWorker for h` | `WW:www.example.` |
| `ServiceWorker f` | `SW:www.example.` |
| `ServiceWorkerMa` | `SvcWorkerManage` |
| `Time profiler t` | `TimeProfTimer`   |
| `Time profiler`   | `TimeProfiler`    |
| `WebGL thread`    | `WebGL`           |
| `Choose a device` | `DevicePicker`    |
| `Pick a file`     | `FilePicker`      |
| `Pick files`      | `FilePicker`      |

[1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
2021-07-19 00:57:48 +09:00
Simon Sapin
a0d9f97c8e Fix warnings introduced in newer Rust Nightly
This does not (yet) upgrade ./rust-toolchain

The warnings:

* dead_code "field is never read"
* redundant_semicolons "unnecessary trailing semicolon"
* non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021"
* unstable_name_collisions "a method with this name may be added to the standard library in the future"
* legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
2021-02-25 15:36:03 +01:00
Jonathan Kingston
0e1479cc84 Add creation url and Secure Contexts 2020-11-25 18:30:50 +00:00
Paul Rouget
7653c6c9fc update keyboard-types crate 2020-06-29 10:27:54 +02:00
Matthias Deiml
fa18cf620f Make url for "client" referrer mandatory 2020-06-17 19:07:14 +02:00
atouchet
ca30ec02fc More Cargo.toml updates 2020-05-31 08:55:28 -07:00
Simon Sapin
d4227b5b0d Remove some unused dependency declarations
This is based on compiling with `RUSTFLAGS="-W unused_crate_dependencies"` (CC https://github.com/rust-lang/rust/pull/72342) in a recent Nightly (more so than used in the tree as of this writing, CC https://github.com/servo/servo/issues/26661 for work-arounds).

Only one crate is actually removed from the dependency graph, others are still dependended from other places.
2020-05-29 00:04:34 +02:00
Josh Matthews
301bde2f13 Update serde_json. 2020-04-23 16:08:40 -04:00
Anthony Ramine
9996e48500 Remove syn 0.15 from our crate graph (fixes #24421)
This required bumps of:

* gleam
* image
* rust-webvr
* webrender
* webxr
2020-03-05 13:01:13 +01:00
Josh Matthews
3fd3c23e17 Update ipc-channel and crossbeam-channel. 2020-02-20 11:15:13 -05:00
Kunal Mohan
8d4aeef08b
move ConstellationMsg to compositing 2020-01-29 23:34:16 +05:30
Anthony Ramine
785a344e32 Update rand to 0.7 (fixes #24448) 2019-10-23 15:34:48 +02:00