Commit graph

29421 commits

Author SHA1 Message Date
Oriol Brufau
aeeb3cb488
layout: Avoid recomputing automatic inline size (#39375)
Laying out a block-level box that establishes an independent formatting
context may require multiple attempts because it needs to avoid floats.
We were previously recomputing the automatic inline size every time,
even if it was always the same. Now we will only compute it once.

Testing: Not needed, no behavior change

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-18 21:00:16 +00:00
Ritoban Dutta
a5c584f72a
script: Replace DomRefCell<bool> with Cell<bool> for Response::redirected (#39351)
Replace DomRefCell<bool> with Cell<bool> for Response::redirected field.

Changed redirected field from DomRefCell<bool> to Cell<bool> and updated
all related methods:
- Struct field: redirected: DomRefCell<bool> → redirected: Cell<bool>
- Constructor: DomRefCell::new(false) → Cell::new(false)
- Getter method: *self.redirected.borrow() → self.redirected.get()
- Setter method: *self.redirected.borrow_mut() = value →
self.redirected.set(value)

Testing: As noted in the issue, compilation is sufficient for this
change.

Fixes: #39288

Signed-off-by: ritoban23 <ankudutt101@gmail.com>
2025-09-18 15:12:55 +00:00
Euclid Ye
af7de5ccf1
script: Avoid panic when scrolling area of window is larger than viewport (#39367)
Sometimes, the computed scrolling area of window is larger than
viewport. This causes panics in `Window.scroll` with `f32::clamp(0.0,
some negative number)`.

Eventually, we should find out why "computed scrolling area of window is
larger than viewport". But let's avoid the panics first.

Testing: This avoids panic, so definitely not covered by existing tests.
But it would be hard to write a automated test for this in headless
mode.
Fixes: #39346

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-18 07:51:53 +00:00
Euclid Ye
f508b1e5af
webdriver: Remove TODO comments of focusing steps (#39366)
Our current implementation already gets the "TODO" done for focusing
steps.


https://searchfox.org/firefox-main/source/dom/html/nsGenericHTMLElement.cpp#3491-3497

Testing: No. Just updating comments

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-18 06:54:49 +00:00
Martin Robinson
020b82e1fe
profile: Remove integration with Instruments.app "Points of Interest" (#39354)
This changes removes the integration with Instruments.app "Points of
Interest" track for a variety of reasons:

 - This functionality is made somewhat redundant by Servo's support for
   Perfetto traces.
 - This functionality depends on the `signpost` crate which hasn't seen
   activity for 9 years and only supports macOS.

Testing: This removes some functionality that is only observable via
Instruments.app, so testing it is difficult.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-09-18 02:37:00 +00:00
Jonathan Schwender
666b17a9a1
canvas: Port CanvasMsg channel to generic channel (#39348)
Additionally also improve the warning message if the routed receiver
disconnects and exit the thread.
If the routed receiver disconnects, we can't receive any canvas messages
anymore, and any control messages can't remedy that, so we might as well
exit.

Testing: Channel changes are covered by existing tests. Exiting the
canvas thread if the routed thread disconnects is not tested, and needs
reviewer attention.
Part of https://github.com/servo/servo/issues/38912

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-09-18 00:06:08 +00:00
Narfinger
76645e5e26
servoshell: Update the debug options (-Z) help to reflect current set of options (#39316)
The command-line help output for `-Z` and `DebugOptions were out of sync
again. This change makes sure they match again.

Testing: No tests necessary as this mainly just updates the help output.
Fixes: #39311

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-09-17 15:07:39 +00:00
Martin Robinson
5505d00334
libservo: Remove Opts::webrender_stats and -Z wr-stats (#39331)
This option is supported via the WebView API now and you can enable it
in servoshell by pressing `Ctrl` + `F12`. The command-line argument and
`Opts` field are older and I believe are no longer necessary.

Testing: This just removes a redundant command-line option, so no tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-09-17 11:58:16 +00:00
Jonathan Schwender
eaca68472b
migrate GenerateImageKey reply to generic channel (#39347)
Testing: No functional changes. Covered by existing wpt tests.
Part of https://github.com/servo/servo/issues/38912

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-09-17 11:30:26 +00:00
Jonathan Schwender
d848bd2759
generic channel: Migrate background hang monitor to GenericChannel (#39345)
Refactor the background hang monitor channels to use GenericChannel. 
Deserialization errors of `BackgroundHangMonitorControlMsg` are now
logged and ignored instead of causing a panic.

Testing: No major functional changes. Covered by BHM tests.
GenericChannel is also already widely used in servo.
Part of #38912

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-09-17 11:11:07 +00:00
Tim van der Lippe
6cba44e0e3
script: Do not start Fetch operations if they have been aborted by the AbortController (#39295)
The first step for aborting fetch calls. It only
has the case where the signal was already aborted
prior to fetch starting.

Part of #34866

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-17 08:49:27 +00:00
Kingsley Yung
e3818a33c0
script_bindings(python): Handle WebIDL methods named with Rust keywords (#39343)
Some WebIDL methods, attributes and dictionary members are named with
Rust keywords such as `type`, `use` and `continue`. Using those
identifiers directly in the generated Rust code would cause compilation
errors.

The code generator already addresses this issue for attributes and
dictionary members by adding a `_` suffix to the conflicting
identifiers, but does not yet apply the same treatment to methods. This
patch extends the handling to methods as well.

Fixes: #39286

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-09-17 04:09:02 +00:00
Euclid Ye
8c50c44942
script: Do not call "scroll into view" when handling element clicks (#39326)
Previously, when we click any element, it would trigger "scroll into
view". What's worse, for an anchor `<a>`, clicking it would "scroll into
view" instead of navigating to the url until you retry the click. The
reason is that we built `scrollIntoView` into the focus transaction
system with default option. However, the default `preventScroll` for
`FocusOption` is false according to spec, which triggers "scroll into
view" by default with focus triggered by interaction.

This PR
1. Adds spec document for those which really expects "scroll into view",
i.e. `<form>` when validating data.
2. Make sure when we begin focus transaction, we prevent "scroll into
view".
3. `Focus` method of element/document stays unchanged, which by default
scroll into view if no parameter provided according to spec.


Testing: Manually tested on `servo.org` and other websites, and examples
with `<form>` still correctly scroll into view when validation fails.
Fixes: #38616

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-17 02:23:14 +00:00
Oriol Brufau
18b3e5fe21
layout: Make lines non-phantom if they have inline padding/border/margin (#39058)
According to https://drafts.csswg.org/css-inline/#invisible-line-boxes,
if a line box contains non-zero inline-axis margins, padding or borders,
then it can't be phantom.

Therefore, this patch makes adds a `has_inline_pbm` flag to the line.
Note that we can't use the `has_content` flag, because that would add a
soft wrap opportunity between the padding/border/margin and the first
content of the line.

The patch also renames `InlineFormattingContext::had_inflow_content` to
`has_line_boxes`, which is what we care about for collapsing margins
through.

Testing: Adding new tests
Fixes: #39057

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-16 22:18:46 +00:00
Oriol Brufau
4451ce0ef1
layout: Fix propagation of overflow to viewport (#39173)
This patch refactors the logic for propagating overflow to the viewport,
fixing various issues:
- Now we won't propagate from the root element if it has no box. Note
the fix isn't observable in Servo because we lack scrollbars.
- If the first `<body>` element has no box, we won't keep searching for
other `<body>` elements. This deviates from the spec, but aligns us with
other browsers.
- We won't propagate from the `<body>` if it has no box. We were already
handling `display: none` but not `display: contents`. This deviates from
the spec, but aligns us with other browsers.

Also, when we flag the root or `<body>` as having propagated `overflow`
to the viewport, we retrieve the `LayoutBoxBase`. Therefore, now we get
the computed style from the `LayoutBoxBase` in a single operation,
instead of first retrieving the style from the DOM element and then
getting the `LayoutBoxBase` from the box.

Testing: Adding more tests. We were only failing one of them, but it's
hard to test the fixes given that we don't show scrollbars. The tests
that were already passing are useful too, e.g. Firefox fails one of
them.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-16 20:53:46 +00:00
Tim van der Lippe
22fbb3458b
Add signal to request (#39290)
The signal taken from the requestinit is now passed into
the request object with the relevant steps. I added all
spec comments to this method, as I had trouble figuring
out which steps I had to add.

This required implementing the algorithm to create
dependent signals, which is used in the `any()` method.
So that's now implemented as well.

All of that required the machinery to have dependent and
source signals on an AbortSignal. It uses an IndexSet
as the spec requires it to be an ordered set.

Part of #34866

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-16 20:41:12 +00:00
Simon Wülker
1898a740a8
script: Use xpath ns resolver to resolve namespace prefixes (#39321)
The xpath resolver is a function provided by the user to resolve
namespace prefixes. Previously, we were ignoring the argument.

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-16 17:25:45 +00:00
Kingsley Yung
f3d5617349
script: Check whether the generated crypto key has empty usages (#39328)
The WebCryptoAPI spec requires that when we generate crypto keys by the
generateKey method of SubtleCrypto interface we have to check whether
the usages is empty. If the usages is empty, throw a SyntaxError.

FYI, Step 9 of
https://w3c.github.io/webcrypto/#SubtleCrypto-method-generateKey

We have not yet implemented this logic, and this patch implements it.

Testing: Pass WPT tests that were expected to fail.

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-09-16 17:23:42 +00:00
Martin Robinson
7b755471c7
libservo: Remove the Opts::trace_layout (#39332)
This is currently unused, so it can be removed.

Testing: This just removes an unused field, so does not require tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-09-16 17:12:18 +00:00
Kingsley Yung
64115c6197
script: Remove redundant step in UnwrapKey method of SubtleCrypto (#39323)
In Step 15, we are given the unwrapped key as bytes. If the format is
"jwk", we execute parse-a-JWK algorithm to parse it (and deserialize it
to a JsonWebKey dictionary).

In next step, we perform the import key operation on the unwrapped key.
In our current implementation, we serialize the JsonWebKey dictionary
(when format is "jwk") back to bytes, in order to perform the import key
operation.

In fact, this serialization step is redundant since we have already been
given the unwrapped key as bytes in Step 15. We can directly use it for
perform the import key operation. This patch remove this redundant step
of re-serializing the JsonWebKey dictionary.

Testing: Refactoring only. No change in tests.

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-09-16 15:23:36 +00:00
Mukilan Thiyagarajan
07b2ff5d60
script: use Element::create instead of DOM struct constructors (#39325)
Creating elements by directly calling their interface constructors leads
to some state not being intialized correctly (see #39285). It is also
not in line with the specifications as many of them refer to the
[`create an element`][1] algorithm when an element needs to be created,
which directly maps to `Element::create` in the script crate.

So, switch all such places where elements are created by script to use
`Element::create`.

[1]: https://dom.spec.whatwg.org/#concept-create-element

Testing: Existing WPT tests.

Fixes: #39285

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-09-16 09:26:42 +00:00
Integral
2b261b02bf
net: use log::error! to handle DevTools startup failures gracefully (#39320)
Replace the `unwrap()` call with `log::error!()` in the
`send_request_to_devtools()` function to enhance error handling.

---

Before:
```
╰─❯ ./servo --devtools=1
[2025-09-15T14:35:07Z ERROR servoshell::desktop::app_state] Saw Servo error: DevtoolsFailedToStart!
called `Result::unwrap()` on an `Err` value: "SendError(..)" (thread tokio-runtime-5, at components/net/http_loader.rs:435)
[2025-09-15T14:35:07Z ERROR servoshell::panic_hook] called `Result::unwrap()` on an `Err` value: "SendError(..)"
```

After:
```
╰─❯ ./servo --devtools=1
[2025-09-16T01:24:59Z ERROR servoshell::desktop::app_state] Saw Servo error: DevtoolsFailedToStart!
[2025-09-16T01:24:59Z ERROR net::http_loader] DevTools send failed: sending on a disconnected channel
[2025-09-16T01:24:59Z ERROR net::http_loader] DevTools send failed: sending on a disconnected channel
...
```

Signed-off-by: Integral <integral@member.fsf.org>
2025-09-16 01:55:16 +00:00
Narfinger
22dcc8a49d
Get the Rc to the custom_reaction_stack outside the loop instead of using the thread_local inside. (#39310)
This uses the ScriptThread::custom_element_reaction_stack to call the
enqueue_callback_reaction on the Rc instead of in the loop.
Potentially saving access to thread_local variables.


Testing: Should not change functionality and should be covered by wpt
tests.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-09-16 01:51:13 +00:00
Andrei Volykhin
8c3acaaec9
html: Validate descriptors tokens on 'srcset' attribute parsing (#39317)
Follow the specification and validate tokens of the "x/w/h" descriptors
before applying the rules for parsing float-pointing numbers or
non-negative integers.
https://html.spec.whatwg.org/multipage/#parsing-a-srcset-attribute (step
13)

Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-09-15 17:34:56 +00:00
Jo Steven Novaryo
b1ab72e589
Set composed flag for TouchEvent (#39138)
Following the definition of `TouchEvent` in
https://w3c.github.io/touch-events/#list-of-touchevent-types, all
`TouchEvent` should have its `composed` flag set to be able to propagate
past a shadow root layer.

Part of #35997
Testing: Would require a testdriver.

Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
2025-09-15 08:50:16 +00:00
Euclid Ye
8f4ced66d7
script: Make EventTarget::fire return bool according to spec (#39308)
This is a continuation of #38566, newly discovered when fixing
https://github.com/servo/servo/issues/38616#issuecomment-3261561671.

We add more documentation and return `bool` for the function family of
[event firing](https://dom.spec.whatwg.org/#concept-event-fire).

Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-15 08:07:08 +00:00
araya
2947476bdd
Fix Response:bodyUsed behavior to return false if the body is null (#39287)
This PR fixes some test-cases in
https://wpt.fyi/results/fetch/api/response/response-consume-empty.any.html?product=servo

Fetch standard indicates `Response:bodyUsed` should return `false` if
the body content is null , even if the stream was disturbed.
https://fetch.spec.whatwg.org/#dom-body-bodyused

> The bodyUsed getter steps are to return true if
[this](https://webidl.spec.whatwg.org/#this)’s
[body](https://fetch.spec.whatwg.org/#concept-body-body) is non-null and
[this](https://webidl.spec.whatwg.org/#this)’s
[body](https://fetch.spec.whatwg.org/#concept-body-body)’s
[stream](https://fetch.spec.whatwg.org/#concept-body-stream) is
[disturbed](https://streams.spec.whatwg.org/#is-readable-stream-disturbed);
otherwise false.

---------

Signed-off-by: araya <araya@araya.dev>
2025-09-14 08:33:54 +00:00
Wu Yuwei
a0c3dcefe4
chore: update wgpu to v26 (#39016)
Vello has updated to wgpu v26 recently. It might be a good time for
servo to update as well. This PR should wait for #39015 and #38717

Testing: WebGPU CTS
Fixes: None

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2025-09-14 04:09:17 +00:00
Tim van der Lippe
3ef3ba9378
Add spec steps and comments for fetch abort steps (#39283)
While trying to figure out what the status of this implementation was, I
added steps and comments to
see what we are missing. Also updated some links,
since I couldn't find an implementation of
`window.fetch`, since the spec URL was pointing
to the chapter instead of the algorithm.

Part of #34866

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-13 18:34:14 +00:00
Tim van der Lippe
2f252c9b78
Remove the dom_trusted_types_enabled preference (#39281)
Everything related to Trusted Types has been implemented. Failing WPT
tests are related to other features such as SVG scripts.

Fixes #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-13 09:57:15 +00:00
Oriol Brufau
c11670b067
layout: Take text-indent into account in min/max-content inline sizes (#39230)
The min-content and max-content inline sizes of an inline formatting
contentext need to take `text-indent` into account. Note it can be set
to a negative amount, so the `ContentSizesComputation` logic needs some
tweaks to handle it well.

Testing: Fixes various WPT tests

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-13 06:20:39 +00:00
Tim van der Lippe
d1c3e5f58f
Add trusted type checks for eval arguments (#39263)
Also bumps mozjs to the latest version that has support for
`GStackVector` which is what this callback uses.

Part of #36258

Fixes #38877

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-12 19:08:26 +00:00
Narfinger
033da09800
Move signals_slots to ScriptMutationObservers (#39275)
Both places where we access signals_slots already have a reference to
ScriptMutationObserver. This saves us another access to
with_script_thread.


Testing: This does not change functionality.
Fixes: Part of addressing: https://github.com/servo/servo/issues/37969

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-09-12 18:43:59 +00:00
Kingsley Yung
250c4cda00
indexeddb: Implement openCursor and openKeyCursor for object store (#39080)
Continue on implementing indexeddb's cursor.

This patch focuses on implementing the `openCursor` [1] and
`openKeyCursor` [2] methods of the `IDBObjectStore` interface, which
create and initialize cursors by running the iterate-a-cursor algorithm
[3].

It also adds struct `IndexedDBRecord` to
`components/shared/net/indexeddb_thread.rs`. This struct can later be
used to implement the new `IDBRecord` interface [4].

[1] https://www.w3.org/TR/IndexedDB-2/#dom-idbobjectstore-opencursor
[2] https://www.w3.org/TR/IndexedDB-2/#dom-idbobjectstore-openkeycursor
[3] https://www.w3.org/TR/IndexedDB-2/#iterate-a-cursor
[4] https://w3c.github.io/IndexedDB/#record-interface

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

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-09-12 16:54:07 +00:00
Euclid Ye
1f63116bdd
webdriver: Add ScrollBehavior::Instant for scroll_into_view (#39265)
There is a recent spec change which adds instant as default scroll
behaviour: https://github.com/w3c/webdriver/pull/1924. This PR reflects
the change.

Testing: No behaviour change as `ScrollBehavior` is ignored right now.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-12 15:49:40 +00:00
Kingsley Yung
a4c6108cbe
script: Check if IndexedDB key path is ECMAScript identifier name (#39255)
From IndexedDB spec, when we check whether a key path is valid, we have
to check whether it is an ECMAScript identifier name. We have not yet
implemented this logic, and always return true.

This patch uses the function `js::rust::wrappers::JS_IsIdentifier` to
achieve this checking.

Testing: Pass WPT tests that were expected to fail.
Fixes: #25324

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-09-12 15:02:28 +00:00
Rodion Borovyk
4aabc67e57
constellation: Use one image cache thread pool in the single-process mode (#38783)
Previously, each ScriptThread was creating a new image cache with a
separate thread pool. These changes add an image cache to the
constellation and create new image caches by calling the
`create_new_image_cache` method. It reuses the original image cache's
thread pool and reduces the number of spawned threads in the
single-process mode.

Testing: Tested manually, using `ps -M` to see the number of spawned
threads with multiple tabs open in servoshell before and after these
changes.
Fixes: #37770

Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
2025-09-12 12:35:26 +00:00
Andrei Volykhin
965e87d006
html: Ignore a parse error on 'srcset' attribute parsing (#39260)
Parsing the 'srcset' attribute of an image element may result in a parse
error
indicating a non-fatal mismatch between the input and the requirements.
https://html.spec.whatwg.org/multipage/#concept-microsyntax-parse-error
https://html.spec.whatwg.org/multipage/#parse-a-srcset-attribute

This error should not be a reason to stop parsing and may be used by the
user agent to signal a syntax error.

Other browsers generally ignore this error, and we do the same.

Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-09-12 06:45:01 +00:00
Kenzie Raditya Tirtarahardja
097a69169a
webdriver: Support "scroll into view" for commands (#38508)
Implement scroll into view steps for all WebDriver command that requires
it (element click, element send keys, element clear, and take element
screenshot).

Testing: `element_send_keys/scroll_into_view.py`,
`element_click/scroll_into_view.py`, `element_clear/clear.py`

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
2025-09-12 06:07:58 +00:00
Oriol Brufau
9e9bd80bba
layout: Add style to ConstraintSpace and IndefiniteContainingBlock (#39229)
They only had the writing mode, now they will have the entire computed
style.
This is needed for #39230.

Testing: Not needed, no behavior change

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-11 21:53:14 +00:00
Shubham Gupta
dfdcba88d4
fixup: Enable viewport <meta> tag support for mobile platforms only (#39207)
1. Adds a pref viewport_meta_enabled.
2. Enable pref for mobile platforms.

Testing: Tested Manually
Fixes: #39157
Fixes: #39002

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
2025-09-11 17:21:04 +00:00
Ashwin Naren
96592dce44
Invalid return type for key conversion (#39252)
`convert_value_to_key` returns a `ConversionResult` now, so keys can be
considered "Invalid" rather than throwing an exception.

Testing: WPT
Unblocks: #38288

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-09-11 12:48:18 +00:00
Narfinger
19f70dccf6
Combine some access to the thread local variable for script thread. (#38752)
This combines some access to the thread local variable for script
thread.

- We introduce a new UserInteractingScriptGuard which on drop handles
  the resetting of was_interacting to the previous value. Sometimes
throughout the code `ScriptThread::is_user_interacting` was reset to the
previous value while sometimes just set to false. This should
remove this footgun.
- This also reduces the amount of thread local access for
MutationObservers and task queue.

Testing: WPT tests should cover this.
Fixes: This addresses part of
https://github.com/servo/servo/issues/37969 but there is probably still
stuff to be done.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-09-11 09:40:32 +00:00
Kingsley Yung
5de041e6ef
script: Unwrap imported key in JWK format after normalizing (#39234)
In our current implementation, the `importKey` method and `unwrapKey`
method of `SubtleCrypto` interface unwrap JsonWebKey before running the
normalized algorithms. Therefore, all cryptography algorithms share the
same unwrapping mechanism. Our current unwrapping mechanism is not
compatible with some cryptography algorithms, which we have not yet
implemented such as Ed25519.

Following the WebCrypto API spec, this patch moves the JsonWebKey
unwrapping mechanism to normalized algorithms so that each cryptography
algorithm can unwrap JsonWebKey in its own way.

This does not introduce behavioral changes, but makes implementing the
unwrap operation for new cryptography algorithms easier in the future.

Remark: Step 8 and 13 of `SubtleCrypto::ImportKey` require the crypto
task source in the script task manager, but we don't have it yet. So,
they're marked as TODO.

Testing: Existing tests should suffice.

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-09-11 09:38:21 +00:00
Ashwin Naren
97690b1cba
script: Ensure autoincrement and keypath are passed in correctly from IDBTransaction (#38738)
Previously, the correct autoincremented and keypath parameters were only
being passed if the object store is being created. This PR queries this
info from the backend and passes it onto the constructor in
IDBTransaction. Furthermore it exposes keypath and index_names from
IDBObjectStore, mainly for WPT.

Testing: WPT
Fixes: None

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-09-11 09:13:15 +00:00
Simon Wülker
3b294d0856
net: Add spec comments to "cors_preflight_fetch" (#39246)
I added these comments while debugging `cors/request-headers.htm`.
Ultimately the bug turned out to be outside of servo, so we have to wait
for https://github.com/hyperium/headers/pull/219.
Since that PR might take a while to merge I'd like to add these on their
own.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-11 01:31:51 +00:00
Simon Wülker
93ad2cf62a
script: Set validation anchor to target element in ElementInternals::SetValidity when anchor is not given (#39247)
Testing: Covered by existing web platform tests

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-11 01:26:09 +00:00
webbeef
bc496b08e7
Enable the zstd decoder (#36530)
Uses the `zstd` support from `async-compression` to support zstd
Content-Encoding.

Testing: Covered by wpt tests.

Signed-off-by: webbeef <me@webbeef.org>
2025-09-10 14:58:45 +00:00
Narfinger
84465e7768
Removed FnvHash and transformed the rest to FxHashmap (#39233)
This should be the final PR for the Hash Function series that is
trivial.

Of note: I decided to transform `HashMapTracedValues<Atom,..>` to use
FxBuildHasher. This is likely not going to improve performance as Atom's
already have a unique u32 that is used as the Hash but it safes a few
bytes for the RandomState that is normally in the HashMap.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Hash function changes should not change functionality, we
slightly decrease the size and unit tests still work.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-09-10 13:34:54 +00:00
Euclid Ye
726b456120
webdriver: Focus WebView asynchronously (#39241)
#38160 added a webdriver-specific API to support waiting on focus
operations to complete. Later, #38243 added a unique id to track each
focus operation.

Back then we wait on focusing webview in webdriver hoping to improve
stability, but it does not matter as it turns out later. #39086 also
focuses browsing context asynchronously.

This PR would make webdriver's focusing-webview behaviour same as human
interaction.

Testing: 
[Before 1](https://github.com/yezhizhen/servo/actions/runs/17598288280),
[Before 2](https://github.com/yezhizhen/servo/actions/runs/17598289360),
[Before 3](https://github.com/yezhizhen/servo/actions/runs/17598290532)
[After 1](https://github.com/yezhizhen/servo/actions/runs/17598282988),
[After 2](https://github.com/yezhizhen/servo/actions/runs/17598280603),
[After 3](https://github.com/yezhizhen/servo/actions/runs/17589228530)

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-10 07:36:53 +00:00