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>
Add a check for formatting of the `Cargo.toml` files to CI, and run
`taplo format` to fix existing formatting issues.
---------
Signed-off-by: Martin Garton <garton@gmail.com>
This prevents unintended updates the `uv.lock` file which must be
reverted locally.
Testing: As this just fixes a runtime issue when running `test-tidy`,
this
probably doesn't deserve a test.
Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
Co-authored-by: Martin Robinson <mrobinson@abandonedwig.info>
Add further missing repository keys / descriptions, which I missed in
#43451 due to a suboptimal grep (assuming that rust-version.workspace is
always the last item).
Additionally fix crate self-references, which caused cargo-publish to
fail, due to it trying to fetch the crate from crates.io.
When specifying the current crate in `[dev-dependencies]` to enable a
test feature or similar, apparently one should not use `workspace =
true` and instead use `path`.
This requires extending the previously added `tidy` check, to allow
`path` dependencies in this specific case outside of the workspace
Cargo.toml.
Testing: Covered by existing tests
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
In order to prepare for publishing this PR does the following steps (see
commits):
- Move all `path` dependencies to the workspace Cargo.toml, and
reference that.
- Move all path dependencies in the workspace Cargo.toml into a
dedicated section, to make bumping version numbers easier later.
- Add the version requirement. Note that we currently only version bump
servoshell. There was agreement to version everything with the same
version as servoshell, but that be done in a follow-up. The diff is
already large enough as is.
- Add a tidy lint to catch `path` usages outside the root Cargo.toml. I
switched to [`tomllib`] (which was added to the python stdlib in 3.11),
since the third-party `toml` library failed to parse Cargo.toml files
with `workspace.version` (did not like the `.` in a `key`).
[`tomllib`]: https://docs.python.org/3/library/tomllib.html
Testing: Should be covered by regular CI testing.
---------
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>
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>
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>
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>
This new lint checks for some easy mistakes to make with the annotation
format.
Testing: New unit tests added.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Similar to about:license in firefox. Generated with `cargo-about`.
A few open questions:
- When/how should it be updated (the command I used was `cargo about
generate etc/about.hbs > resources/resource_protocol/license.html`, it
takes ~20 seconds)
- How should `about.toml` be kept in sync with `deny.toml`
- What about licenses for packages that are not crates (i.e. gstreamer)
Fixes: #40266
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
- Remove unused accepted Copyright line `See
http://rust-lang.org/COPYRIGHT`. This URL now yields a 404, and we don't
seem to use this line anywhere in the project so we can remove it. Note:
We should probably use a regex anyway, so we can match the whole
required expression, but thats a different topic.
- Remove unused `licenses_dep_toml` table. We use cargo deny for
checking the licenses of our rust dependencies.
Testing: Changing tidy is covered by `./mach test-tidy` in CI
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
The patch implements Compression (https://compression.spec.whatwg.org/)
with the compression and decompression provided by the `flate2` crate
(https://crates.io/crates/flate2).
`flate2` supports several different backends, controlled through the
crate's features. By default, it uses `miniz_oxide`
(https://crates.io/crates/miniz_oxide).
`flate2` provides three modules `read`, `write` and `bufread` which work
on instances of the `std::io::Read`, `std::io::Write` and
`std::io::Bufread` traits, respectively. The `write` module is chosen in
the patch since it matches the streaming model in the specification.
Testing: Enable WPT for Compression API, and introduce WPT expectation.
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Removes files that once were used for testing tidy checks which are no
longer performed, such as:
- json formatting
- lock files check which was superseded by cargo deny,
- checking for long lines and multiline strings
- sorting alphabetically #![feature(...)] statements
Testing: Not required, unused files removed
Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This is a first draft at implementing the required infrastructure for
CookieStore, which requires setting up IPC between script and the
resource thread to allow for async/"in parallel" handling of cookie
changes that have a promise API.
Cookie Store also will need to receive change events when cookies for a
url are changed so the architecture needs to support that.
Expect this PR to be reworked once the architecture becomes more
settled, cookie change events will be implemented in follow up PRs
Testing: WPT tests exist for this API
Part of #37674
---------
Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This shows up sometimes in code reviews, so it makes sense that tidy
enforces it. `rustfmt` supports this via comment normalization, but it
does many other things and is still an unstable feature (with bugs).
Testing: There are new tidy tests for this change.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This changes will introduce [flake8-annotations
(ANN)](https://docs.astral.sh/ruff/rules/#flake8-annotations-ann) for
python type annotation, this will make all thing related to function
strictly typed in python
This rule will start to affected this directory from now:
- /python -> Root directory
- /python/tidy
- /python/wpt
Testing: `./mach test-tidy`
Fixes: Not related to any issues
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
- Remove all handling of comments and attributes. This was not affecting
the checks in any way.
- Remove `is_associated_type()` as it was unused.
- Remove the check for `&String`, `&Vec`, operators at the end of the
line, and the unit return type as clippy already checks these (and
handles the mutable variants).
Testing: This is covered by tidy script tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This change replaces our custom `panic` / `unwrap` lint with the one
from clippy. This rule as not properly applied in servoshell, so this
change fixes some clippy errors raised by the new configuration.
Testing: This change removes the tidy tests for the custom lints, but
otherwise the behavior is tested as part of clippy itself.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
As we plan to adopt more rules from Ruff and rustfmt, we would like to
retire the following rules:
1. `Line length check`, as this is already handled by Ruff and rustfmt
configurations.
2. `Alphabetical order`
Testing: `./mach test-tidy --no-progress --all`
Fixes: #37121
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Fix wpt lint logic to respect servo-tidy.toml ignores and --all flag
Testing: Should be covered on CI
Fixes: #38510#37991
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Currently, our implementation for each line-checking function reads the
file as bytes, so we need to properly decode each line to UTF-8 before
evaluating it. This ensures it is counted as a string and not as bytes
Testing: I tested by changing the comment like the issue above and it
not give an error
Fixes: #38237
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
This is the first stage of adopting Pyrefly. It introduces the Python
folder and focuses on fixing issues around it.
Testing: *Describe how this pull request is tested or why it doesn't
require tests*
Fixes: *Link to an issue this pull requests fixes or remove this line if
there is no issue*
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
The initially used config is compatible with flake8 rules, including all
pycodestyle (pep8) and pyflakes rules.
Testing: Broke some python files and used `mach test-tidy --all` to test
the linting.
Fixes: servo/servo#37041
Signed-off-by: zefr0x <zer0-x.7ty50@aleeas.com>
Some methods are implemented fully, while others are implemented
partly. With these implementations, there are no observed crashes
when running the trusted-types web-platform-tests.
Most notably, the tests/wpt/tests/trusted-types/idlharness.window.js
is now fully passing.
Part of #36258
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
* Start working on a basic URLPattern implementation
This is API part of Interop 2025, so we should definitely support it!
This change implements the basic workflow for parsing
and compiling URL patterns. Parts of it are stubbed out and will be
implemented later.
For now the API is preference-gated behind "dom_urlpattern_enabled".
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Preference-gate the URLPattern API
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update WPT expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fix full wildcard value (Should be ".*" not "*")
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
The issue here is mainly that some of the lines are longer than 120
characters. Just add linebreak where appropriate.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Instead of parsing the `Cargo.lock` file directly in `tidy.py`. Use
`cargo-deny`, which we already use to detect unapproved licenses in the
dependency chain to detect duplicate and banned crates. In addition,
enable all other `cargo-deny` checks and add exceptions where necessary
for them. This depends on the latest release of `cargo-deny` which
depends on a recent verison of `rust`.
Fixes#34393.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This change fixes all rustdoc errors and also adds a tidy check for a
very common rustdoc URL issue. Eventually rustdoc warnings should likely
cause the build to fail, but this catches those issues sooner in order
to not waste so much developer time.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This restores the behaviour prior to #32540 where the case where no
merge commit being found (which happens on CI in forks because we do
a shallow clone) is handled as if no changes where found.
Fixes#32550.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
PR #32465 broke the lint because it initializes FileList with a
file name (./Cargo.lock). This causes it to always return an empty
list when the `only_changed_files` parameter is `False` since `os.walk`
requires a directory and not a file.
Fixes#32530.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Use cargo-deny to check license compliance.
All licenses should be MPL-2.0 or weaker.
* Run cargo-deny check licenses in mach tidy
* fmt
* Fix inverted boolean
* Move cargo deny to tidy.py
* Add quotes around license in error message
* Integrate `cargo-deny` into tidy fully
* Fix script tests
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
1. Make the tidy output easier to follow
2. Integrate the WPT manifest cleanliness step into tidy
itself and don't run it if nothing has changed in the WPT
directory.
3. Fix an issue where Python test requirements were not installed,
which could cause issues with some modules not being found.
Fixes#30002.