A published or vendored package will not have access to gstreamer.py.
Hence, we move the package list into libservo, and modify the remaining
usage of gstreamer.py (in mach) to read the same list.
Testing: Covered by CI testing, which involves building servo and the
macos dmg and windows installer.
Fixes: Part of #43145
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This is required to publish script_bindings, since all files used during
codegen need to be there.
It might also be possible to generate the bindings ahead of time and
vendor them in-tree, but this seems painful to setup from a CI
perspective.
Since there don't seem to be any other users in-tree we can just vendor
into the script-bindings directory.
`ply` is licensed under the BSD 3 clause, and WebIDL under MPL-2.0, with
the licenses available in our cargo package. Both tools won't end up in
`servo` since they are build-time dependencies, so I believe we don't
need to adjust the crate license, or configure `about.toml`.
Testing: Should be covered by existing tests. We don't test if this
allows vendored builds or published builds.
Fixes: Partial fix for #43145
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
The CVE doesn't impact us, so we can ignore it safely. This improves the
comment above the ignored entry in deny.toml. We test our own code via
`clippy` and we aren't using the vulnerable type. Our dependencies could
in theory use it, but that seems rather unlikely.
Testing: test-tidy is tested in CI.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
As discussed on zulip we would like to rename `libservo` to `servo`
(again) before a future crates.io release.
Servo is a library, so the `lib` prefix is somewhat redundant. We
already renamed the binary of ServoShell to `servoshell`, to reduce
confusion of users of what servo is.
Note: This PR does not touch all occurrences of `libservo`. Specifically
CI job names remain untouched, since the risk of breaking something is
higher here, harder to test for and the name not user facing.
Testing: CI testing of this change should give us good confidence.
Manual testing of `./mach doc` and `./mach build` showed no issues on
macos. [Full try
run](https://github.com/jschwe/servo/actions/runs/22909562747)
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
We should only send previews of ordinary objects[^1] (i think that's the
correct term) objects to the devtools. The code is not designed to
handle other objects, which currently causes crashes.
Testing: This change adds a devtools test that crashes without this
change.
[^1]: https://tc39.es/ecma262/#ordinary-object
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This PR adds a test for `StepIn`, `StepOut` and `StepOver` hooks.
This test is intentionally designed to include all three `StepIn`,
`StepOut` and `StepOver` hooks in one test. This could be tested
separately but in a real use case one is mostly using these hooks
together in a single debugging session, not in isolation.
It is important we mirror that workflow. Also considering this area is
actively under development, it would be easier to catch regressions with
this flow test.
Testing: Added a new test
Fixes: Part of #36027
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: eri <eri@igalia.com>
Add support for navigation requests ("navigateTo", "goBack", and
"goForward") over the Remote Debugging Protocol. These may be sent by a
UI client in response to user input (for example the address bar in the
Firefox inspector), or they can be used to automate navigation during
unit tests.
This currently only supports navigation within the URL domain at which
servoshell is initially launched, due to a bug in servo's
`BrowsingContextActor` implementation. (Unit tests covering a fix for
that issue will depend on this change.)
Testing: The behavior of all 3 new message types is covered by a new
test case—`test_navigation`—in the devtools unit test suite.
Fixes: #38668
---------
Signed-off-by: Brent Schroeter <contact@brentsch.com>
Co-authored-by: eri <eri@igalia.com>
This script automates the signing, packaging and notarization of
servoshell on macOS.
This is a first step towards: #40031 and #12532. While we could let a
maintainer code-sign and upload the signed release, probably this should
be integrated into CI, which would require additional work.
This script started out quite simple as part of `./mach package`.
However, since the script has access to secrets, it shouldn't be part of
mach (to minimize the amout of code that needs to be trusted).
We also needed to save state and be able to resume operations, since
notarizing can take quite long and the stapling needs to wait until
notarization has completed.
Since notarizing can take long (up to a day has been observed during
first tests), we save artifacts and the notarization ID, and add a
`--check-status` command that can be used to poll if notarization has
been finished.
Testing: Manually testing required. A signed and notarized `.dmg`
artifact has [been
uploaded](https://servo.zulipchat.com/#narrow/channel/500774-tsc/topic/Signing.20macos.20Servoshell/near/576256648)
to zulip, allowing others to verify the notarization worked.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
We had two `Info.plist` files. The maintained one is in the root
directory of this repository.
There is no reason for two plist files, so remove the unmaintained one.
Additionally, we also move the maintained version from the root
directory to the servoshell directory.
Testing: We don't test the contents of the plist file.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
See #42956. It's quite likely that this code has bitrotted and if this
feature is desired, should probably download the nightlies from GitHub
and also be updated to support our current packaging output.
Testing: This is just removing unused code from our build scripts.
Fixes: #42956.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This is a preparation for publishing to crates.io. Changes include:
- Add `servo-` prefixes to avoid name collisions on crates.io
- Use `-` instead of `_` in package names.
- Rename the crates to their original names in Cargo.toml,
to keep the diff minimal
- Rename `media` to `servo-media-thread` to avoid name collision with
`servo-media` (originally from the media repository).
This is an outcome of the previous discussion at [#general > Switch
remaining git dependencies to
crates.io](https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Switch.20remaining.20git.20dependencies.20to.20crates.2Eio/with/576336288)
Testing: This should be mostly covered by our CI, but some amount of
breakage is to be expected, since some package names could still be
referenced from scripts which are not tested or run in CI. [mach try
run](https://github.com/jschwe/servo/actions/runs/22502945949)
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Add `./mach print-env` to export the environment variables mach sets to
stdout and `./mach exec` to execute an arbitrary command in the custom
environment. This allows users to easily run custom commands, or tools
in the same environment as mach would create without adding support
every tool. Note: `./mach print-env` is only targeting UNIX shells for
now, although probably one could detect the shell and e.g. also support
PowerShell (in theory).
In principle, simple commands like `./mach cargo-fix` could be removed
and instead used via `./mach exec cargo fix`.
The execution of commands via `./mach exec my_command` (e.g. running
custom tools like cargo-flamegraph) still has some limitations, since
arguments that the user might have meant to pass to the command, might
be eaten by `./mach` (if mach expects that parameter, e.g. `--target
<triple>`. It's recommended to delimit explicitly by adding `--`., e.g.
`./mach exec --ohos -- cargo build --target aarch64-unknown-linux-ohos`.
Without the `--` delimiter, `./mach would interpret `--target` instead
of passing it to `cargo build`.
Testing: Manual testing of `./mach print-env --ohos`.
Fixes: #25473#38223
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
We don't use the CLOBBER file anywhere. The CLOBBER was introduced in
d03e52d240, but without any commit
message. Judging by the CLOBBER file in that commit, this was related to
the CI machines at the time. Should be safe to remove.
Testing: Well, this probably should be reviewed by someone who is
familiar with the background. Not covered by any tests.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
As said in
https://github.com/servo/servo/issues/42803#issuecomment-3957052680,
there's been a weird discrepancy between running wdspec tests in:
1. local / Linux WPT workflow
2. WebDriver Try
For 2, it triggers FAIL/ERROR that never happen in 1. It is not
intermittent, but always happens.
This PR makes 2 have same behaviour as running locally: default number
of processes (CPU count. For self-hosted runner workflow, this is
double. Hyperthreading?), single chunk.
This improves the running time by 2 mins as well.
Testing: The test results now work same as Linux WPT and local.
https://github.com/servo/servo/actions/runs/22385441028/job/64795317878#step:11:552Fixes: #39097Fixes: #42803
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This cleans up some of the informational print statement during
`build_env()` to go to stderr instead.
This opens up stdout usage to print information to stdout for
consumption (in a follow-up PR)
Testing: Covered by `./mach build --ohos` in CI.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Currently, `script` and `devtools` use a node's unique id to identify it
across requests. The unique ID is part of a node's rare data field and
is really only meant for debugging. Instantiating it on a node causes
it's memory usage to go up significantly. Now, when the devtools ask for
information about a specific `Node` then they send the unique ID to
`script`, and the script thread then walks the whole DOM tree searching
for that specific ID. This happens here:
6d0b651218/components/script/devtools.rs (L142-L153)
So, in the worst case, all of the nodes in the tree now have a unique
ID. That's not great!
Also, when `script` notifies `devtools` about changes to a DOM node then
`devtools` expects a `NodeActor` to exist for that Node. The actor might
not exist if the inspector doesn't know about that node yet - that
happens when the user hasn't expanded their parent yet.
That is an oversight from https://github.com/servo/servo/pull/42601 and
causes problems now(https://github.com/servo/servo/issues/42784) because
for the longest time, `devtools` was mostly the one sending requests. Of
course, we could make `devtools` simply ignore updates for nodes that it
doesn't know about, but ideally we shouldn't send these updates in the
first place.
This change implements a lookup map on the `ScriptThread` that contains
all nodes that have been sent to the devtools inspector. The map allows
us to efficiently resolve a unique ID to a `Node` in O(1), without
creating unique IDs for the whole tree. It also allows us to only send
DOM updates for nodes that the inspector cares about.
For now, entries from the cache are not evicted unless the relevant
pipeline is closed. That reflects reality, because the inspector also
keeps using them forever.
In the future we will tell the inspector when nodes are removed from the
tree - then it can't interact with them anymore, and we can remove them
from the script-side map.
This is change is not all that complicated but it involves moving a lot
of code around, so feel free to ask for clarification when something is
unclear!
Testing: This change adds a test
Fixes part of https://github.com/servo/servo/issues/42784
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This should prevent recurring issues with exported WPT changes being
prevented from merging due to failing linting checks upstream.
Testing: Can't test WPT linting integration at this point in time.
Fixes: #40662
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
The pause debugger screen should be shown for both pausing manually
(interrupt) and hitting a breakpoint.
Reuse the logic for pausing breakpoints to pause the debugger when the
user manually clicks the pause button.
Rename the pause event to interrupt to match the language of the
DevTools client and to avoid confusion with paused frames, which can
happen on interrupt or on a breakpoint.
https://github.com/user-attachments/assets/ceb0007d-0e57-44d6-a159-55980ff8b517
Testing: New DevTools test and manual testing.
Part of: #36027
cc @atbrakhi
---------
Signed-off-by: eri <eri@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
The inspector view allows modifying the attributes of DOM elements.
However, we lie to the devtools client: While it looks like the
attributes change, the changes are never actually applied to the DOM.
This change fixes that, and also makes it so attribute modifications
from non-inspector sources are shown in the inspector.
Testing: This change adds two tests
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This change makes the devtools inspector show any event listeners that
are attached to a node. The primary motivation is making the devtools
more useful for debugging real-world websites.
<img width="536" height="268" alt="image"
src="https://github.com/user-attachments/assets/5ba13e41-14b4-4202-b994-eadff5d1c6b5"
/>
You can also click on the event listener to show some more info, though
most of that (everything except the event type and the event phase) is
currently just placeholder text:
<img width="1360" height="456" alt="image"
src="https://github.com/user-attachments/assets/ec025847-43fc-489c-8b26-46afb6dada64"
/>
Testing: This change adds a new test
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This allows us to `console.log` objects from JS and have a preview of
them appear in the console.
Interacting with said preview doesn't work yet, because the devtools
object actor is a stub.
<img width="600" height="78" alt="image"
src="https://github.com/user-attachments/assets/d896471f-3982-4406-94d4-b13eebabe337"
/>
Testing: This change adds a test
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
`contextdir.chdir` is not thread-safe, but the formatting runs
synchronously in a single thread, so it's fine.
Testing: Made some changes to various `.rs`, `.py`, and `.toml` files,
and ran `../mach fmt` from a few different subdirectories to ensure it
picks up the files to reformat.
Fixes: #42472
Signed-off-by: pralkarz <pralkarz@tuta.com>
Skip push hooks for try command. This speeds up try for me, which
normally means waiting for clippy a second time. The commit step is
already using `--no-verify`.
Testing: tested this change locally and it works
Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This helps buddies from MI5, MI6, NSA etc. to run tests behind proxy.
Testing: Tested locally behind proxy. For some reason, I already set
`127.0.0.1` and `localhost` in `no_proxy`, but it does not work.
Fixes: #42321
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
All other browsers use a single configuration for their browser
invocations on WPT. Servo historically had two: servo and servodriver.
Now that we run WPT on Servo GitHub CI with Webdriver using the
servodriver, we can align our configuration with theirs.
The existing "servo" configuration is renamed to "servo_legacy" and
"servodriver" is then renamed to "servo". This way, we preserve the
"servo" product name as defined on wpt.fyi, but we do use its webdriver
configuration.
Since webdriver is not fully working yet for debugging purposes, we keep
the "servo_legacy" configuration now. In the future, once the debugging
story has improved, we can remove "servo_legacy".
All in all, this ensures that both on local, Servo GitHub CI and on
wpt.fyi we all use the exact same configuration. I tested this locally
by running the following test:
```
./mach test-wpt tests/wpt/tests/css/css-overflow/scrollbar-gutter-dynamic-004.html
```
This does times out with the servo binary and works with the servodriver
binary.
Running the servo_legacy configuration is done via the `--servo-legacy`
flag:
```
./mach test-wpt tests/wpt/mozilla/tests/mozilla/caption.html --servo-legacy
```
Fixes#40751
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This bumps stylo to allow configuring the stack size of the stylo
threads, which fixes crashes with asan and debug builds.
Testing: Manual testing with `--with-asan` and with the debug profile.
Fixes: #40814
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Switch to using our own dockerfile, and install the required
dependencies into our image.
In follow-ups we can build the docker image in CI, so that users can
download a prebuilt docker image to save time.
Testing: Manually tested by opening servo in the devcontainer and
running `./mach build`
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This allows us to reuse the list without python, e.g. from a
shell-script. This is useful to build docker image layers, without
requiring python / uv / mach first.
Future changes will split the list into multiple text files, so we can
install only required subsets (e.g. skipping gstreamer) and a workflow
to automatically sync changes to the book.
Testing: `./mach bootstrap` still works.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This change finishes the big rename associated with the old
`compositing` crates. Long ago, these crates managed a compositor, like
you might find in a traditional web engine. These days, compositing is
done in WebRender so the name has stopped making much sense. Various
structs inside the crates have already been renamed and this is the
final big change necessary for the rename
Testing: This is just a rename so existing tests should cover it.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Probably we should use a proper linter like `shellcheck`, but in the
meantime make the lint slightly smarter, so that it doesn't complaint
about e.g. `$1`. This is especially a problem when adding scripts which
use `awk`, since our lint is quite stupid and doesn't understand `''`
strings.
This fixes linting, for a simple new script introduced in
https://github.com/servo/servo/pull/41775
Testing: ./mach test-tidy still passes.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Instead of attempting to manage the virtual environment ourselves, use
`uv` to manage the installation of dependencies.
Since we still have dependencies coming from upstream wpt, we use
`[tool.setuptool]` in our pyproject.toml to ensure that `uv` dynamically
installs our dependencies according to the requirements.txt files.
Additionally, this PR also reverts `--no-project` usage. `--no-project`
was added as a temporary workaround in
https://github.com/servo/servo/pull/37741.
It's not 100% clear to me what exactly the issue was, but
[apparently](https://github.com/servo/servo/pull/37741#pullrequestreview-2985666234)
the issue caused the build to break.
Removing the arg seems to work fine, except that we get a warning about
a missing `requiress-python` value in `pyproject.toml`.
Apparently it is good practice to specify the requirement as `>=` in th
pyroject, and lock the exact version via `uv pin` (which writes to
`.python_version`, where we already pin 3.11.
Testing: Should be covered by existing tests, which compile code on all
platforms.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This change moves the upload and attestation steps to the nightly
workflow. This results in overall slightly more code, but reduces the
amount of code that has access to extra privileges.
Additionally, this refactoring will allow to easily change the target
repo for the nightly release, i.e. allowing us to reuse the nightly
workflow for our monthly releases in the servo/servo repo (in a
follow-up PR).
We change upload_nightly to get an additional `packages` parameter, that
we use instead of a hardcoded table of expected packages per platform.
`download-artifact` doesn't preserve the whole directory structure, so
it would be a bit cumbersome to preserve that.
Since we anyway only use the upload script in CI, we can just directly
specify the packages in the CI, which also makes things slightly more
flexibel if we want to add new packages or platforms.
There are still more improvements to come, specifically also to the
`upload_nightly` script, with the goal to minimize the amount of code
that needs to be trusted.
Testing: Manually triggering the [release
workflow](https://github.com/servo/servo/actions/runs/20996682863/job/60358012404)
via workflow-dispatch.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Instead of relying on the contents of the already-parsed arguments,
which may have tried to convert URL arguments to paths, parse URLs from
their original place in `sys.argv`. This is a workaround to the fact
that we extend the internal WPT update command to accept URLs of GitHub
Actions. This is a custom Servo extension that has no equivalent to
the WPT upstream command.
Testing: There aren't really tests for this level of the Servo command
line tools.
Fixes: #41728
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The versions of `cargo-deny` older than 0.18.6 have a bug which causes
the executions of `cargo-deny check` to prematurely fail when reading
the advisory db
(https://github.com/EmbarkStudios/cargo-deny/issues/804).
This error is ignored by `test-tidy` since the error message doesn't
have the expected JSON fields, causing `test-tidy` to succeed even when
there are valid issues in `deny.toml` or `Cargo.lock`.
So upgrade the `cargo-deny` version installed by `mach` to be the latest
version and ensure that at least the version with the fix is installed
on the system. Also fix the `test-tidy` code to always fail when the
exit code from `cargo-deny` is non-zero.
This patch also updates `deny.toml` to include exceptions to allow
`./mach test-tidy` to pass. Some of these need to be investigated
separately from this change.
Fixes#41845.
Fixes#38945.
Testing: Tested locally on NixOS.
---------
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
The book was changed, so we need to update the link to the new location.
Testing: Only changes comment. Reviewers can review by following the new
link.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>