Replaces a big match statement with a call to `unicode_script`'s
`Script::short_name` method which has the same big match statement. We
special case `Script::Unknown` because the `short_name` method returns
empty string for that variant, but harfbuzz represents it with `Zzzz`.
EDIT: `Zzzz` seems to be in the spec so I've sent a PR to
`unicode_script` to use it:
https://github.com/unicode-rs/unicode-script/pull/23
EDIT: And https://github.com/unicode-rs/unicode-script/pull/24 which
would allow us to remove this method entirely.
Signed-off-by: Nico Burns <nico@nicoburns.com>
This is part of introducing the Ruff rule [flake8-annotations
(ANN)](https://docs.astral.sh/ruff/rules/#flake8-annotations-ann) into
the script_bindings folder.
Since `codegen.py` has 10k lines of code, the strategy is to introduce
the rule first while ignoring the `ANN` Ruff rule for `codegen.py`. We
will then gradually add type annotations slice by slice to ensure no new
errors occur outside of `ANN`.
Testing: `./mach test-wpt webidl`
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Since we don't enable the preference as part of
`--enable-experimental-web-platform-features` yet, we don't run any
automated tests for the AbortController feature. This change means that
we at least explicitly test the interface.
Testing: Just enabling new tests.
Part of: https://github.com/servo/servo/issues/34866
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Includes a fix, which deletes the SDK for ohos-native hosts, saving some
disk and cache space, since we only need the version for linux hosts.
Testing: [mach try
ohos](https://github.com/jschwe/servo/actions/runs/17024914816)
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Testing: only safety annotations change, no tests are required.
Fixes: https://github.com/servo/servo/issues/38627
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
I had a difficult time figuring out where the relevant steps had to be
added. Therefore, I aggressively commented the spec steps so eventually
I discovered where I should add them.
Part of #36258
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This only covers the global event handlers for now, while I figure out
which others we are missing. We don't seem to be missing the
WindowEventHandlers, but not sure where the others coming from.
Part of #36258
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Replace a hand-written MallocSizeOf implementation with an automatically
derived one. This exposes more than 1MB of previously-untracked heap
data on servo.org.
Testing: Compared about:memory output for servo.org before and after.
Part of: #11559
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
IDBKeyRange::Bound doesn't check if the lower bound is greater than the
upper bound. When this happens, it should throw DataError.
Reference: Step 5 of
<https://www.w3.org/TR/IndexedDB-2/#dom-idbkeyrange-bound>
Testing: Passing WPT tests that were expected to fail before.
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Vendors the [blink perf
tests](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/perf_tests/).
These perf tests are useful to evaluate the performance of servo.
The license that governs the perf tests is included in the folder.
Running benchmark cases automatically is left to future work.
The update.py script is taken from mozjs and slightly adapted, so we can
easily filter
(and patch if this should be necessary in the future.
Testing: This PR just adds the perf_tests, but does not use or modify
them in any way.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Implements (de)serialization behavior for QuotaExceededError and enables
the annotation on the WebIDL spec.
Testing: Adds its own WPT tests
Fixes: https://github.com/servo/servo/issues/38685
---------
Signed-off-by: Rahul Menon <menonrahul02@gmail.com>
JS scripts that are evaluated already run with an [entry
script](https://html.spec.whatwg.org/#entry) on the script settings
stack. The codepaths that do something with the return value (eg.
WebDriver and embedder JS evaluation) have the potential to run
additional JS, since they can trigger getters for arbitrary properties
of objects, so they also need an entry script present in case code like
e649b9b91d/components/script/dom/location.rs (L182)
is executed.
Testing: Added a regression unit test.
Fixes: #38692
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Adds a global preference observer that is notified whenever any
preference value is updated. This is used to support runtime
configuration of WebXR automated testing, which is a prerequisite for
running multiple WPT tests in a single browser session.
Testing: Ran `./mach test-wpt /webxr --product=servodriver`
Fixes: #38647
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
- Use sqlite instead of heed. (one indexed database = one sqlite
database)
- Implement the backend for indexes
- Use keyranges where needed (as specified by the spec)
- Implement `getKey`
- Fix channel error messaging (led to a bunch of changes to how async
requests are handled)
Note: `components/net/indexeddb/engines/sqlite/serialize.rs` is unused;
I can delete it if needed.
Testing: Switching to sqlite eliminated many panics (exposing some new
failures).
Fixes: #38040
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
If `.as_singleton()` was called on a range that had both lower and upper
set as `None`, it would have panicked.
Testing: Nothing seems to have changed
Fixes: #37647
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
There is no reason to roll our own type.
Motivation: I need `ExternalImageSource::Invalid`.
Testing: Covered by existing WPT tests, but it's just refactor
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Callers now call `set_attribute` directly, to avoid the trusted types
machinery, as well as skip validation. That's not required by spec as
well.
This implements part of the DOM integration from
https://github.com/whatwg/dom/pull/1268
Part of #36258
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.88
to 0.1.89.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/async-trait/releases">async-trait's
releases</a>.</em></p>
<blockquote>
<h2>0.1.89</h2>
<ul>
<li>Improve IDE functionality (<a
href="https://redirect.github.com/dtolnay/async-trait/issues/293">#293</a>,
thanks <a
href="https://github.com/Veykril"><code>@Veykril</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a7e91e98a5"><code>a7e91e9</code></a>
Release 0.1.89</li>
<li><a
href="fbcfcaca02"><code>fbcfcac</code></a>
Merge pull request 293 from Veykril/lw/quote_spanned</li>
<li><a
href="fd93990620"><code>fd93990</code></a>
Improve use of spans in <code>quote_spanned</code></li>
<li><a
href="a5093fe762"><code>a5093fe</code></a>
Add type-mismatch ui test</li>
<li><a
href="6d12b44116"><code>6d12b44</code></a>
Revert "Pin nightly toolchain used for miri job"</li>
<li><a
href="dd9e4bad1b"><code>dd9e4ba</code></a>
Hide unused_variables warning in consider-restricting.rs ui test</li>
<li><a
href="b454fc869a"><code>b454fc8</code></a>
Update ui test suite to nightly-2025-08-03</li>
<li><a
href="9c880e85d8"><code>9c880e8</code></a>
Update ui test suite to nightly-2025-07-30</li>
<li><a
href="7ca751d0b3"><code>7ca751d</code></a>
Ignore unused_parens warning in test</li>
<li><a
href="2bccfeb461"><code>2bccfeb</code></a>
Update ui test suite to nightly-2025-05-28</li>
<li>Additional commits viewable in <a
href="https://github.com/dtolnay/async-trait/compare/0.1.88...0.1.89">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Instead of making a block for each attribute, use a single block as
described in a `FIXME` comment by @emilio. This also switch to using
`map` and `and_then` in more places to make the code a bit more concise.
Testing: This should not change behavior other than to incraese
efficiency a
bit and is thus covered by existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Use skrifa instead of freetype for extracting raw table data. Allows us
to replace unsafe Freetype code with safe Skrifa code. Also allows us to
avoid copying the table data. Instead we return Arc'd data.
---------
Signed-off-by: Nico Burns <nico@nicoburns.com>
This part of function strictly typed in python by adding ANN rule in
ruff, similiar to #38531.
Testing: `./mach test-tidy`
Fixes: Not related to any issues
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
This change supplements the missing stylesheet invalidation
notifications to fix some bugs that the modification of stylesheet does
not take effect. Additionally, this PR add a RAII thing to mark the
modification scope of stylesheet rules, which will facilitate to add
extra logic before the modification happens.
Fixes: there is relevant issue #38211 , but it can't be fixed by this
PR.
Testing: This fixes some subtests in
`/css/cssom/CSSStyleSheet-constructable.html`.
Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
`webview_relative_mouse_point` can have negative y-coordinate when at
toolbar, but we still would notify compositor the native mousebutton
event to do hit-test.
Testing: This fixes the way that mouse events are passed from servoshell
to Servo,
but there is currently no way to test those kind of interactions.
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Currently, the response tab for a request's detail in devtools does not
show the available data, this was due to how the content is being
structured (not the way firefox's devtools client expects it) and also
the body being discarded and not stored in the actor.
This PR stores the body in the actor , which is then retrieved in
`getResponseContent` and then use it to instantiate the new struct
`ResponseContentObj` which matches the format firefox's expects
Fixes: https://github.com/servo/servo/issues/38128
---------
Signed-off-by: uthmaniv <uthmanyahayababa@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This implements the `TextEncoderStream` WebIDL interface.
Testing: Existing WPT tests should be sufficient
Fixes: #37724
---------
Signed-off-by: minghuaw <wuminghua7@huawei.com>
Implment get window handles according to
[spec](https://w3c.github.io/webdriver/#dfn-window-handles).
- Window handles are supposed to identify `browsing context`. However,
based on `get window handle command` and `get window handles command`,
we only need to care about top level browsing context.
- Back then, we use a random generated uuid for eacch webview id, it is
not correct but still work because all commands depend on `webview id`
and `browsing context id`. The only case we need window handle is is
when webdriver gets window object with js script. Since the object is
converted to the id of window's document node, `get window handle`
should return the same thing.
Action run (with updated expectation):
https://github.com/longvatrong111/servo/actions/runs/16957610535https://github.com/longvatrong111/servo/actions/runs/16957612027
Some tests may sporadically timeout due to unstable hit test.
cc: @xiaochengh
---------
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
According to spec of
[hit-test](https://w3c.github.io/uievents/#hit-test) for native mouse
event, mousedown/mouseup should also be excluded when interacting with
disabled element, even tho it may be the frontmost of
[elementFromPoint](https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint).
Testing: Now it matches the behaviour of other browsers in #38670 for
disabled element. Also testdriver test:
`tests\wpt\tests\html\semantics\disabled-elements\disabled-event-dispatch.tentative.html`
has 4 more passing tests.
Fixes: Part of #38670.
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.10.0 to 1.11.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rayon-rs/rayon/blob/main/RELEASES.md">rayon's
changelog</a>.</em></p>
<blockquote>
<h1>Release rayon 1.11.0 / rayon-core 1.13.0 (2025-08-12)</h1>
<ul>
<li>The minimum supported <code>rustc</code> is now 1.80.</li>
<li><code>iter::repeatn</code> has been renamed to
<code>iter::repeat_n</code> to match the name
stabilized in the standard library. The old name still exists as a
deprecated
function for compatibility.</li>
<li>Fixed a bug in <code>in_place_scope</code> when the default global
registry uses the
current thread, like on WebAssembly without threading support.</li>
<li><code>binary_heap::Iter</code> no longer requires a temporary
allocation.</li>
<li>Relaxed trait bounds on many of the public structs.</li>
<li>Implemented <code>IntoParallelIterator for Box<[T]></code> and
its references.</li>
<li>Implemented <code>FromParallelIterator<_> for
Box<str></code> via <code>String</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="6236214d71"><code>6236214</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/1031">#1031</a></li>
<li><a
href="652f11176a"><code>652f111</code></a>
Release rayon 1.7.0 and rayon-core 1.11.0</li>
<li><a
href="7df001da1b"><code>7df001d</code></a>
Tweak plumbing consumer description</li>
<li><a
href="322dfe87e4"><code>322dfe8</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/1026">#1026</a></li>
<li><a
href="099241d410"><code>099241d</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/1030">#1030</a></li>
<li><a
href="a17bcb90aa"><code>a17bcb9</code></a>
Fix inappropriate use of slice::as_mut_ptr</li>
<li><a
href="98077fe07c"><code>98077fe</code></a>
Be more cautious about drain drops</li>
<li><a
href="706969515c"><code>7069695</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/1028">#1028</a></li>
<li><a
href="874ff73125"><code>874ff73</code></a>
Fix docs for the yield <code>None</code> case on
<code>ThreadPool</code></li>
<li><a
href="58f7b7ec9d"><code>58f7b7e</code></a>
Be careful comparing <code>job_ref.execute_fn</code></li>
<li>Additional commits viewable in <a
href="https://github.com/rayon-rs/rayon/compare/rayon-core-v1.10.0...rayon-core-v1.11.0">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
CookieStore spec graduated from WICG and the test suite in WPT got
renamed to `cookiestore` from `cookie-store`. This readds the baseline
CookieStore expectations in preparation for landing an implementation.
Testing: Reenables tests and readds expectations that were removed.
Signed-off-by: Sebastian C <sebsebmc@gmail.com>
Replace static_assertions in the `size_of_test` macro with `const
assert`s. The error message is still informative.
Additionally also remove the `cfg` guard, which caused the assertion to
only be enabled on 64 bit platforms, which is something one would not
expect given the name `size_of_test` of the macro.
`cargo tree -i static_assertions` now points to only `stylo` using
`static_assertions`, so we should be able to remove this dependency
fairly easy, since the macro doesn't seem to be used there either at
first glance.
Testing: Covered by existing tests.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Implement Serialize and Deserialize for GenericReceiver to also allow
the Receiver to be sent across
ipc channels.
This is necessary to allow using the GenericChannel in more places.
Testing: Manually tested on follow-up feature branch. Does not require
new tests.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Implements the new WebIDL interface for QuotaExceededError and uses it
in appropriate places.
Testing: WPT tests. Now passing many more in
`tests/wpt/tests/WebCryptoAPI/getRandomValues.any.js` and
`tests/wpt/tests/webstorage/storage_session_setitem_quotaexceedederr.window.js`.
Fixes: #38489
---------
Signed-off-by: Rahul Menon <menonrahul02@gmail.com>
Add basic support for storing layout data for pseudo-elements nested to
up to two levels. This removes the last unstored layout result and fixes
a double-borrow issue. This change does not add properly parsing nor
styling of these element types, but does prepare for those changes which
must come from stylo.
Testing: This fixes a intermittent panic in
`tests/wpt/tests/css/css-lists/nested-marker-styling.html`
Fixes: #38177.
Closes: #38183.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Previously,
[`SetProperty`](https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty)
implemented step 3 before calling into the inner `set_property` method,
which implements step 1. Therefore if step 3 returned then step 1 never
runs, and can't throw an exception.
Testing: A new web platform test starts to pass
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
The `Canvas2dMsg::MeasureText` is dropped inside `send_canvas_2d_msg` if
the canvas is not paintable,
leading to a panic on the receiving end. Checking the paint-ability
before sending the message prevents this panic, and if the canvas is not
pain-table, a default text metrics is used.
Testing: Manual testing of the minimal test case in the associated
issue, and crash test added.
Fixes: https://github.com/servo/servo/issues/36845
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.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>
Renames `--branch-start-point`, `--branch-start-point-hash`, and
`--branch-reset`, in favor of `--start-point`, `--start-point-hash`, and
`--start-point-reset`, according to [Bencher's
Docs](https://bencher.dev/docs/reference/changelog/#v0421).
Fixes: #38501
---------
Signed-off-by: Timmy <timmy@Timmys-Mac-mini.local>
Signed-off-by: Timothy Elems <timmy@Timmys-Mac-mini.local>
Signed-off-by: elemstimothy@protonmail.com <timmy@Timmys-Mac-mini.local>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Timmy <timmy@Timmys-Mac-mini.local>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Currently, the options are only initialized once and then never changed.
Making this explicit allows optimizing accesses, e.g. caching opt
values.
For some options like `multiprocess` it is obvious that we would never
want to support changing the value at runtime, however there are other
options where it could be conceivable that we want to change them at
runtime. However, imho such options might be better suited to put into a
different datastructure, so that it is explicit which options can be
changed at runtime, and which are fixed.
Testing: Covered by existing tests (and manually running servo in
multiprocess mode).
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
#38584 moves input event handling to new `DocumentEventHandler`, but
probably reintroduced some removed code when resolving conflict with
#38589.
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>