Commit Graph

12473 Commits

Author SHA1 Message Date
WaterWhisperer
84487008ec script: Replace RefCell with DomRefCell in svgsvgelement::cached_serialized_data_url (#41547)
Testing: [WPT
tests](https://github.com/WaterWhisperer/servo/actions/runs/20552524367/job/59033378580)
Fixes: #41539

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-12-28 12:56:20 +00:00
Kingsley Yung
c77cc00474 script: Add helper function for setting JsonWebKey key_ops attribute (#41544)
Add a helper function `JsonWebKey::set_key_ops` for setting JsonWebKey
key_ops attribute to a given list of key usages. This task is very
common in export key operation of different cryptographic algorithms.
Adding this helper function helps simplify our code.

Testing: Refactoring. Existing tests suffice.

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-28 05:02:30 +00:00
Kingsley Yung
bb84e0dac3 script: Add helper function to handle JsonWebKey common encoding tasks (#41472)
Companion of #41428, which added helper functions to handle JsonWebKey
common decoding tasks.

This patch adds a helper function `JsonWebKey::encode_string_field` to
handle common base64url encoding tasks across multiple algorithms.

Testing: Refactoring. Existing tests suffice.

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-27 17:19:30 +00:00
Sam
d7324d7279 script: Pass &mut CurrentRealm in callbacks (#41536)
Continuation of #41520 to use more safe cx in promises, now by passing
&mut CurrentRealm in callbacks. Most callback implementations still do
conversions to old SafeJSContext, so there are some low hanging stuff
for follow ups.


Testing: Should be covered by existing WPT tests.
try run: https://github.com/sagudev/servo/actions/runs/20540030020
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-12-27 16:33:26 +00:00
Sam
6e0e50505e script: Use more new JSContext/CurrentRealm in crossorigin codegen (#41537)
reviewable per commit

Testing: Should be covered by WPT tests.
try run: https://github.com/sagudev/servo/actions/runs/20540365373
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-12-27 15:59:32 +00:00
Sam
600accba82 script: Support new context for promise and add some more helpers to ease migration (#41520)
This PR adds support for using new JSContext/CurrentRealm to promise and
adds some more helpers that will ease migration to new context model.
Second commit has another demo.

Testing: Covered by WPT
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-12-27 13:11:37 +00:00
Martin Robinson
f418c1272f base: Move Unicode offset types to base (#41521)
This moves the Unicode offset types to the `base` crate and makes them
generally more usable throughout the Servo codebase. In addition, they
are renamed to use Rust naming and to be a bit more consistent:

 - `UTF8Bytes` -> `Utf8CodeUnitLength`
 - `UTF16CodeUnits` -> `Utf16CodeUnitLength`

There is also a bit more documentation explaining their use.

This is preparation for fixing issues with UTF-16 offsets in editable
text fields.

Testing: This does not change behavior so existing WPT tests should
suffice.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-25 14:48:40 +00:00
Andreu Botella
f4307334dc script: Make link elements set ElementState::UNVISITED (#41478)
In Servo, the `:link` and `:any-link` pseudo-classes correctly match
link elements when they are part of a compound selector whose last
simple selector does not start with them (e.g. `a:link` or `:link b`),
but they do not match when the last simple selector starts with `:link`.

The reason for this seems to be that Stylo uses two methods to determine
whether an element is an (unvisited) link: to call the `is_link()`
method on the `selectors::Element` trait, and to check if the element's
state has `ElementState::UNVISITED` set.

In a browser like Servo which does not support visited styles, these two
checks should be equivalent. However, they turn out not to be, because
Servo never actually sets `ElementState::UNVISITED`.

Since per the HTML spec the `:link` selector applies to all `<a>` and
`<area>` elements that have an `href` attribute, this patch fixes this
by setting `ElementState::UNVISITED` on such elements when the `href`
attribute is set, and by unsetting it when it is removed.

Testing: There are two invalidation-related WPT tests about the
`:any-link` selector that now pass with this patch.

Fixes: servo/stylo#282

---------

Signed-off-by: Andreu Botella <andreu@andreubotella.com>
2025-12-24 08:00:40 +00:00
Simon Wülker
c8ed7a7269 layout + script: Use Iterator::sum in more places (#41501)
This change replaces a couple calls to `Iterator::fold` with
`Iterator::sum`.

Testing: No tests, this is a small cleanup PR.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-24 07:58:58 +00:00
Martin Robinson
273c1d54b7 Fix build of ./mach test-unit -p base (#41498)
`malloc_size_of` depends on `tendril` having the `encoding_rs` feature
turned on, but this was only turned on transitively via `html5ever` and
`script`/ `script_bindings` `tendril` dependencies. This change makes it
so that `malloc_size_of` depends directly on `tendril` and moves this
dependency to the root `Cargo.toml`.

Testing: This just fixes a particular build configuration.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-23 17:44:36 +00:00
atbrakhi
ae6f56f194 Separate console.clear() from ConsoleLogLevel (#41495)
Separate `console.clear()` from `ConsoleLogLevel`. See
https://github.com/servo/servo/pull/41311#discussion_r2622642820

Testing: Tested locally. Unfortunately in DevTools tests we do not cover
console tab

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-12-23 14:27:04 +00:00
Gregory Terzian
9cd480f7ee indexeddb: implement databases concept(detete and databases method) (#41322)
Moves the concept of databases closer to the 3.0 spec, by implementing
the delete functionality, and the method returning current databases to
script.

Testing: WPT tests with new passes
Fixes: The "Implement databases deletion and `databases`" item of
https://github.com/servo/servo/issues/40983

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-12-23 14:09:48 +00:00
Steven Novaryo
b68d277c55 script: Add stub VisualViewport Interface (#41372)
Add placeholder implementation of DOM `VisualViewport` according to the
spec https://drafts.csswg.org/cssom-view/#visualviewport. This is the
first step of implementing the interface and syncing it with the
`PinchZoom` struct that we had in the `Embedder`.

Since this interface's is not accurate and couldn't fulfill it's
purpose, it would be gated behind a preference
`dom_visual_viewport_enabled` and would be open after the interface had
been integrated with `PinchZoom`, viewport resizing, and viewport
scroll.

Testing: Existing WPT Test.
Part of: #41341

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
2025-12-23 09:56:13 +00:00
Mukilan Thiyagarajan
2ccd9f54ad libservo: Let UserContentManager be per WebView and add basic support for mutations. (#41352)
This change moves the `UserContentManager` abstraction from the
`ServoBuilder` to `WebViewBuilder` so that embedders can inject content
for each `WebView` independently. It also adds basic support for runtime
mutations to the `UserContentManager` API. Only adding new scripts is
currently supported, but future changes will add support for both other
mutations such as removal of scripts and addition & removal of
stylesheets. Future changes could also optimize the way mutations are
propagated to `ScriptThread`s by sending just the "delta" rather than
the whole `UserContents` structure for each mutation.

The `UserContentManager` now becomes just a convenient handle for the
embedders to invoke the mutation API while the actual management of the
manager's content is handled by the Constellation. The mutations are
relayed to the constellation via messages. The change also separates the
serialized version containg the user contents into a new `UserContent`
structure so that the API cannot be misused.

Testing: New unit tests have been added for the different scenarios
involving UserContentManager.

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-12-23 06:15:01 +00:00
Martin Robinson
55c4f579c9 fonts: Refactor the font fallback code a little bit and remove RwLock around FontGroup (#41449)
This change reworks the logic for finding font fallbacks to make it
simpler. I was involved with writing the code for `FontGroupFamily` and
`FontGroupFamilyMember` and I still struggle a bit with understanding
it, so I've chosen to do this. In addition, the change is in preparation
for more flexible font fallback (#41426).

The main changes here are:
 1. Move the logic for creating a new descriptor with variations into
    the Font constructor.
 2. Add some more general methods to `FontGroupFamily` such as a
    template iterator.
 3. Use `OnceLock` to avoid a convoluted code structure because of
    mutability and also having boolean "loaded" members. This is what
    `OnceLock` and `OnceCell` are for!
 4. Rename `FontGroupFamilyMember` to `FontGroupFamilyTemplate` to
    stress that it is one template of a particular `FontGroupFamily`.

Testing: This should not change behavior so is covered by existing WPT
tests.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-22 15:06:25 +00:00
Oriol Brufau
3ee05f7c7d script: Restrict box tree damage from changes in original display (#41475)
When the original display of an absolutely positioned element changes,
the static position can be affected. However, the static position is
only used when both insets in the same axis are `auto`.

Therefore, this patch avoids dirtying the box tree when both axes have a
non-auto inset.

Testing: Not needed, this should have no observable behavior change

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-12-22 12:58:45 +00:00
Kingsley Yung
007f3379c5 script: Add helper functions to handle JsonWebKey common decoding tasks (#41428)
Add several helper functions to JsonWebKey to handle common base64url
decoding tasks across multiple algorithms. Those helper functions
include:

- `JsonWebKey::decode_optional_string_field`: decode optional field
- `JsonWebKey::decode_required_string_field`: decode required field
- `JsonWebKey::decode_primes_from_oth_field`: decode oth field to primes

These help simplify our code for importing keys in JsonWebKey format.

Testing: Refactoring. Existing tests suffice.

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-22 04:45:16 +00:00
PaulTreitel
008ffa6965 script: Add remaining AES error messages (#41442)
Fill in the error messages across
`script/dom/subtlecrypto/aes_operations.rs` that were still left as
`None`.

Testing: No tests added as these are just error messages.
Addressing: #40756

---------

Signed-off-by: PaulTreitel <paul.treitel@gmail.com>
2025-12-21 20:55:22 +00:00
WaterWhisperer
6623cc1dbb feat: gamepad feature flag (#41451)
Put the Gamepad API and its supporting infrastructure behind a `gamepad`
feature flag. This allows embedders to opt-out of gamepad support at
compile time to save on binary size and reduce dependencies.

Testing:
1. `./mach build -d` (Gamepad enabled by default)
2. `cargo build -p servoshell --no-default-features --features
"libservo/clipboard,js_jit,max_log_level,webgpu"` (Gamepad Disabled)
3. `cargo build -p servoshell --features "gamepad,webxr,..."` (Gamepad &
WebXR Enabled)

Fixes: #40897

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-12-21 13:18:06 +00:00
Jan Varga
1a6b18937a libservo: Add initial SiteDataManager::site_data API (#41378)
This PR adds an initial `site_data` API to `SiteDataManager`, allowing
embedders to obtain a unified list of sites that have associated site
data.

The implementation introduces supporting infrastructure across storage
and
`SiteDataManager` layers, including a small helper for obtaining
WebStorage
origins and initial support for filtering by storage type. At this
stage,
sites correspond directly to origins, future work will extend this to
higher
level grouping (e.g. domain or eTLD+1).

Testing: Added a new integration test covering site data behavior across
localStorage and sessionStorage.

---------

Signed-off-by: Jan Varga <jvarga@igalia.com>
2025-12-21 12:45:43 +00:00
WaterWhisperer
a45186675a script: Support --local-script-source for module scripts (#41445)
The `substitute_with_local_script` logic has been refactored into a
standalone function to allow reuse in `script_module.rs` when a module
script's source is fetched and decoded.

Testing: Verified manually by running Servo with a local HTTP server and
a module script, confirming that the local file correctly replaces the
remote one when the `--local-script-source` flag is provided.

Fixes: #41433

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-12-21 12:30:22 +00:00
Simon Wülker
b0734b7f2d script: Make same-origin iframes inherit encoding from their container document (#41450)
Testing: new tests start to pass
Part of https://github.com/servo/servo/issues/6414

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-21 11:03:30 +00:00
Simon Wülker
a58d9727f9 script: Use chardetng to guess encoding when all else fails (#41435)
[`chardetng`](https://github.com/hsivonen/chardetng) is the library used
by gecko to guess encodings.

This makes https://intsys.co.jp/game/panepon/p01/index.html load with
the correct encoding. Notably, that site uses shift-jis but has no
encoding declaration of any kind.

Part of https://github.com/servo/servo/issues/6414

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-21 08:53:42 +00:00
Taym Haddadi
a926260fb0 Clone request/response bodies per Fetch spec concept-body-clone (#40825)
Implement clone_body_stream_for_dom_body to follow
https://fetch.spec.whatwg.org/#concept-body-clone, teeing the
ReadableStream and wiring the branched streams back into the original
and cloned bodies.

Use clone_body_stream_for_dom_body in Request::clone_from and
Response::Clone so their body cloning follows the Fetch spec algorithms
for request/response cloning, including the shared body stream.

Testing: more WPT test should pass.

Fixes: #36503

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-12-19 16:45:13 +00:00
Tim van der Lippe
fbbfea43d6 script: Implement destroying of top-level navigable (#41355)
Another step towards being spec-compatible. Right now
we can't destroy an unsalvagable document during unloading,
as that breaks all kinds of tests. Before that, we need
to update various machinery to handle destroying correctly.

The first one is a top-level navigable, which explicitly
destroys a document after it is unloaded.

Part of #31973

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 16:30:49 +00:00
Tim van der Lippe
b8ea560b47 script: Implement quota computation for deferred fetches (#41408)
For all upcoming and already-processed deferred fetches, we now
implement a quota. We don't support policy headers yet to configure the
quota, hence we use the default quota. That's why we have some tests
failing again.

It involves computing which document to compute the quota for, as well
as computing total length of requests. Additionally, the DevTools
computation for headers now uses the same logic for headers as deferred
fetches.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 16:24:18 +00:00
Simon Wülker
8c344f5641 script: Prescan byte stream to determine encoding before parsing document (#41376)
Servo currently completely ignores `<meta charset>` tags. When we find
one with an encoding that is incompatible to the current one, then we
should reload the page and start over with the new encoding. A common
optimization that has even made its way into the specification is to
wait for a few bytes to arrive and inspect them for `meta` tags, so the
browser is able to use the correct encoding from the very beginng.

In practice, I've run into problems with our WPT harness when reloading
the page after `meta` tags. Therefore, this change implement the
optimization first, so we never have to reload when running WPT. I've
implemented prescanning in a way where we wait for 1024 bytes to arrive
or for one second to pass, whichever one happens first.

This causes a large number of web platform tests to flip around. I've
looked at most of the new failures and I believe they're reasonable.

Testing: New tests start to pass.
Part of https://github.com/servo/servo/issues/6414

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-19 09:54:19 +00:00
Tim van der Lippe
b02465bc53 script: Mark beacon requests as keepalive (#41405)
This is checked if the body is a stream, but the payload calculation
needs to be in a follow-up PR.

Part of #38302

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 09:01:36 +00:00
Tim van der Lippe
5b6509f279 script: Implement customElementRegistry support for document.importNode (#41385)
This method now allows you to pass in a custom registry. The registry
isn't used yet for callers, since we don't support scoped registries.
However, as we now pass in the registry to `Node::clone`, we set the
registry when creating elements and cloning them.

As such, various tests start passing where we set the registry. Some
tests started failing, but they rely on scoped registries which we don't
support yet. These tests thus flipped: those that were erroneously
failing are now passing and vice versa.

Part of #34319

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 09:01:08 +00:00
Tim van der Lippe
d8bf293828 script: Remove Drop implementation of FetchCanceller (#41384)
Instead, we now explicitly call `.terminate()` and introduce relevant
methods to FetchCanceller.

Follow-up from review in #41345

---------

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>
2025-12-19 08:31:09 +00:00
Kingsley Yung
4539c7efde script: Store HashAlgorithmIdentifier as NormalizedAlgorithm (#41395)
For some dictionaries in SubtleCrypto interface, we store the hash field
of `HashAlgorithmIdentifier` type as a `SubtleKeyAlgorithm`. The
conversion to `SubtleKeyAlgorithm` is unnecessary. Moreover,
`SubtleKeyAlgorithm` is not supposed to be used there.

This patch fixes it by simply storing them as the normalized algorithm
given by Step 10.1.3 of normalization [1], for those hash field of
`HashAlgorithmIdentifier` type.

[1]
https://w3c.github.io/webcrypto/#algorithm-normalization-normalize-an-algorithm

Testing: Refactoring. Existing tests suffice.

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-19 07:20:09 +00:00
Tim van der Lippe
e35a4c81d7 script: Implement destroying of documents (#41346)
The specification has a dedicated method for destroying
documents. Parts of that method were scattered around
various parts of Servo machinery.

This patch consolidates these steps and follow the spec.
Additionally, it now correctly unloads iframes when
they are removed from a parent document.

As a result, the fetch-later WPT test now passes, as
it relies on the correct ordering of iframe unloading
to verify the fetch-later requests are sent.

Part of #31973

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 07:12:46 +00:00
Narfinger
1b0bd11e11 Use GenericSender and GenericReceiver for WebDriver (#40987)
- Use the generic channel for webdriver.
- Implement try_receive_timeout for GenericReceiver.

Testing: WPT should still work.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-12-19 03:22:02 +00:00
webbeef
f81c19226f script: set a bloom filter when creating a MatchingContext (#41368)
Uses bloom filters in `MatchingContext` to make selector matching more
efficient. This seems to improve Speedometer score a bit.

Testing: no new test for that small optimization.

Signed-off-by: webbeef <me@webbeef.org>
2025-12-19 03:21:28 +00:00
Tim van der Lippe
3ac02bc6ac script: Mark fetch-later requests as keep-alive (#41345)
This implements the required plumbing for the keep-alive flag on
requests. The flag already exists on the request object, but now also
exists on the builder itself.

The flag is then passed into a canceller. While we could make canceller
optional, in many cases it isn't and would require a whole lot more
changes. To follow the spec more closely, opted to put the keep_alive
flag on the canceller as well.

Note that this doesn't pass any extra fetch-later tests since we are not
correctly unloading iframe documents. That will be fixed in a follow-up
PR.

Part of #41230

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-18 19:49:13 +00:00
Taym Haddadi
25a626cf3d script: retarget dblclick from input UA shadow DOM to host (#41319)
dblclick on text inputs was being dispatched to an internal element used
for the input, not to the <input> itself. As a result, page scripts
listening for dblclick on the input never received the event.

Testing: tested manually.
Fixes: #41303

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-12-18 13:09:35 +00:00
Simon Wülker
581723c338 script: Remove redundant call to Node::adopt in Node::replace_all (#41373)
All the new nodes will be `adopt`-ed inside the respective calls to
`Node::insert` anyways.

Testing: Hopefully no regressions?

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-18 12:03:41 +00:00
Taym Haddadi
f794a2480d IndexedDB: Handle error of creating new db Step 6 of (#41014)
I added error handling for handle_open_db but I also added it to
SqliteEngine::new and handle_sync_operation because we also open db
there, so I am not sure about these two.

part of #40983

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-12-17 19:11:46 +00:00
atbrakhi
ba1122b4f5 Add ServoDelegate and WebViewDelegate methods for Console API (#41351)
Route console messages through the embedding API instead of printing
directly, giving embedders control over console output handling.

Testing: Should be covered by exsisting tests
Fixes: #41145

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-12-17 19:06:27 +00:00
Kingsley Yung
0261ab1ef9 script: Implement encrypt/decrypt operations of RSA-OAEP (#41316)
Finish adding RSA-OAEP support to WebCrypto API, by implementing the
encrypt and decrypt operations of RSA-OAEP.

Testing: Pass some WPT tests that were expected to fail.
Fixes: Part of #41113

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-17 11:21:31 +00:00
Taym Haddadi
5a8278aad0 Fix hashchange only queue when fragment actually changes (#41325)
Fix hashchange only queue when fragment actually changes

Testing: tested it manually for now. 
Fixes: #41304

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-12-17 05:59:59 +00:00
Tim van der Lippe
3199477f01 script: Implement storing deferred fetches (#41232)
This is the first part of preparation for implementing the keepalive
flag for requests. It requires implementation of the concept of a task
group, which we already sort of have with `DocumentLoader`. Therefore,
we currently already cancel any loads, which should be updated to
ignored kept-alive requests.

However, termination also requires storing of deferred fetches, which
are also kept-alive. Therefore, to distinguish the two, we need to store
them separately as stated with the TODO.

In a follow-up, we can then skip canceling keep-alive requests for both
`navigator.sendBeacon` (which aren't deferred) and `fetchLater` (which
are deferred).

Part of #41230

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-16 19:32:52 +00:00
César Danilo Pedraza Montoya
db8e01076a script: Add error message text to errors in aes_operation.rs (#41292)
add error messages for `encrypt_aes_ctr`, `encrypt_aes_cbc`, and
`decrypt_aes_cbc`

Related issue: #40756

For some of the messages I just used the `fmt::Display` of `UnpadError`,
but maybe these messages should be more specific?

---------

Signed-off-by: César Pedraza <cpedraza@unal.edu.co>
2025-12-16 12:56:43 +00:00
atbrakhi
f3488b25a8 Move devtools_traits::LogLevel to embedder_traits (#41311)
This PR moves devtools_traits::LogLevel to embedder_traits in
preparation of upcoming work on creating a ServoDelegate and
WebViewDelegate method for Console API output. Also see
https://github.com/servo/servo/issues/41145

Testing: only moves code, no functional change
Fixes: part of https://github.com/servo/servo/issues/41145

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-12-16 10:38:30 +00:00
Simon Wülker
9cbb522606 script: Support legacy "background" presentational hint on more elements (#41272)
Testing: New tests start to pass
Fixes https://github.com/servo/servo/issues/41269

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-16 04:22:42 +00:00
Kingsley Yung
706e06315d script: Implement sign/verify operations of RSA-PSS (#41287)
Finish adding RSA-PSS support to WebCrypto API, by implementing the sign
and verify operations of RSA-PSS.

Testing: Pass some WPT tests that were expected to fail.
Fixes: Part of #41113

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-15 16:54:44 +00:00
Kingsley Yung
a36e3dbe19 script: Implement sign/verify operations of RSASSA-PKCS1-v1_5 (#41267)
Finish adding RSASSA-PKCS1-v1_5 support to WebCrypto API, by
implementing the sign and verify operations of RSASSA-PKCS1-v1_5.

Testing: Pass some WPT tests that were expected to fail.
Fixes: Part of #41113

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-15 06:48:52 +00:00
Taym Haddadi
b2aa0ac859 Fix RefCell double-borrow in Window::remove_reporting_observer (#41261)
lot of RefCell already borrowed crashes are because of code like this:
```
if let Some(index) = self
    .array
    .borrow()
    .iter()
    .position(|p| &**p == r_p)
{
    self.array.borrow_mut().remove(index);
}
```
this will always panic whenever the position() finds an index, because
the immutable borrow from borrow() is still alive when we call
borrow_mut().

Fix by ensuring the borrow is dropped before taking a mutable borrow (by
computing the index in a separate scope / temporary), then remove
safely.



Testing: added crash test.
Fixes: #41260

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-12-14 21:11:32 +00:00
WaterWhisperer
bed16a236e script: Replace borrow_mut() with borrow() in AudioBuffer::restore_js_channel_data (#41253)
Avoid borrow hazard in `AudioBuffer::restore_js_channel_data`

Testing: `./mach check` and `./mach test-wpt
tests/wpt/tests/webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html
--pref js_mem_gc_zeal_level=2 --pref js_mem_gc_zeal_frequency=1
--timeout-multiplier=5 --product=servo`
<img width="2661" height="1385" alt="截图 2025-12-14 11-32-13"
src="https://github.com/user-attachments/assets/830ec4a7-17b8-4931-951f-1eb60d373d82"
/>
now it won't crash
Fixes: #41248

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-12-14 06:42:00 +00:00
Kingsley Yung
e8edc8146e script: Remove unused helper functions for RsaOtherPrimesInfo (#41243)
The import and export key operations of RSA algorithms have been
implemented. We actually don't need some helper functions for
RsaOtherPrimesInfo in JsonWebKey, for those operations. This patch
removes those unused helper functions.

Testing: Existing tests suffices.

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-12-13 13:48:43 +00:00