Commit graph

8454 commits

Author SHA1 Message Date
Tim van der Lippe
4c25039d35
Fully implement request constructor body handling (#39514)
This aligns the implementation with the spec, where both input body and
init body are now set. In doing so, it fixes a fetch abort test, since
the stream was missing for the input body.

It also introduces the `unusable` method, as that's the one the spec
uses. The other two getters no longer exist in the spec.

Fixes #39448

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-27 01:52:01 +00:00
batu_hoang
043425cae5
Establish baselines for testdriver.js infrastructure tests (#39496)
Update testdriver infrastructure test expectation.
For now, most failures of testdriver tests are caused by missing
implementation or issue in Servo.

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
2025-09-27 01:51:18 +00:00
Oriol Brufau
89293995f0
script: Chain up scrollIntoView() scrolling to parent <iframe>s (#39475)
Calling `scrollIntoView()` on an element within an `<iframe>` will now
scroll scrolling boxes from the parent document(s), as long as they have
the same origin.

Testing: One existing subtest passes, and adding a new test.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-09-26 22:12:37 +00:00
Tim van der Lippe
b38bf3e606
Avoid crash when non-trusted-script object is passed into Function constructor (#39451)
It is possible to pass in objects that are not trusted scripts into the
Function constructor. Rather than crashing, we now treat these as
untrusted. `can_compile_string_with_trusted_type` doesn't need to know
the contents of a string, as it always marks it as untrusted.

We can make the same optimization in the string case, where we no longer
need to convert the string.

Testing: This change adds a WPT crash test.
Fixes #39436

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-26 18:33:56 +00:00
Tim van der Lippe
461c2427f3
Add abort signal preference to experimental web features (#39421)
This way we have full coverage on WPT rather than the
specific folders with tests.

Part of #34866

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-26 14:41:53 +00:00
Oriol Brufau
38a63a7977
stylo: Add support for -webkit-fill-available sizing keyword (#39492)
This keyword is de-facto required for web compatibility, Firefox is also
enabling it (https://bugzil.la/1988938).

This patch just aliases it to `stretch`.

Stylo PR: https://github.com/servo/stylo/pull/243

Testing: Various tests pass

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-26 10:45:56 +00:00
Oriol Brufau
858208bd25
layout: Align table-cell contents safely (#39491)
As resolved in https://github.com/w3c/csswg-drafts/issues/12220, when
resolving `align-content: normal` on a table cell, we will now use safe
alignment.

The difference only matters when the contents of the cell are taller
than the cell, which doesn't typically happen. But in Servo it's
observable when there are collapsed rows.

Testing: Adding new tests. Some fail because we don't support
`align-content` yet.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-26 07:44:23 +00:00
Oriol Brufau
7a3a28c7f1
layout: Correctly handle margins in sticky positioning (#39393)
This fixes the logic that computes sticky offset bounds in order to
correctly take margins into account.

Testing: One test passes
Fixes: #39389

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-25 16:27:10 +00:00
Martin Robinson
ffdb7d3663
script: Chain up keyboard scrolling to parent <iframe>s (#39469)
When an `<iframe>` cannot scroll because the size of the frame is
greater than or
equal to the size of page contents, chain up the keyboard scroll
operation to the parent frame.

Testing: A new Servo-only WPT tests is added, though needs to be
manually
run with `--product servodriver`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2025-09-25 11:16:41 +00:00
Gae24
75e32ba5a4
script: implement ClipboardItem getType and supports (#39296)
Implement ClipboardItem's getType and supports

Testing: covered by existing tests

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-09-25 08:05:01 +00:00
Oriol Brufau
454d6052b4
layout: Avoid fixed table layout when inline-size is max-content (#39474)
This undoes #35882 according to the last CSSWG resolution, since this is
required by web compat.

Testing: Modifying the relevant test

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-24 18:21:04 +00:00
Simon Wülker
2ccaf86ff6
Invalidate iterator over elements of a XPathResult when the document changes (#39411)
Also includes a fix to not throw a type error in
`XPathResult.invalidIteratorState`.

Testing: Includes a new web platform test
Part of https://github.com/servo/servo/issues/34527

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-24 16:39:38 +00:00
Kingsley Yung
9d7b438d6b
script: Enable crypto task source at task manager (#39453)
The Web Cryptography API has the "crypto task source"
(https://w3c.github.io/webcrypto/#dfn-crypto-task-source-0) to queue
tasks to resolve or reject promises created in response to calls to
methods of `SubtleCrypto`.

This patch enables this task source at the script task manager, and
queue tasks on this task source from existing steps.

A few WPT error expectations are also added to WPT meta. The related
cryptographic algorithms have not yet implemented, so the errors are
expected. I don't know why WPT test did not capture them before.

Testing: Existing tests suffice.

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-09-24 16:21:03 +00:00
Andrei Volykhin
f91dc33350
html: Add the reflected 'sizes' IDL attribute for <image> (#39466)
Add the reflected 'sizes' IDL attribute for <image> element's DOM
interface which defines image sizes for different page layouts.

See https://html.spec.whatwg.org/multipage/#dom-img-sizes

Testing: Improvements in the following tests
- custom-elements/reactions/customized-builtins/HTMLImageElement.html
- html/dom/idlharness.https.html
-
html/semantics/embedded-content/the-img-element/relevant-mutations.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-09-24 09:29:44 +00:00
Simon Wülker
72555de341
Never disconnect shadow roots from their hosts (#39459)
Regular shadow roots can never be detached once they are created.
However we were specifically detaching shadow roots from media elements
when they were disconnected. This is actually one of the very few
aspects of shadow roots that predate the implementation work I did
earlier this year.

I'm not sure why we ever did this. Maybe its for efficiency reasons,
because keeping the shadow tree around is not necessary when the media
element is not connected. But I can't imagine this yields any benefits,
especially since you would have to reconstruct the shadow tree when the
media element is re-connected (as is the case in the crash we observe).

For simplicities sake, I have completely removed this functionality.
Doing so ends up simplifying the code quite a bit.

Testing: This change adds a new crashtest
Fixes https://github.com/servo/servo/issues/36722

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-24 08:04:56 +00:00
Simon Wülker
206dcff080
Assert that style element has an owner in parse_own_css (#39458)
The existing `assert!(node.is_connected())` is wrong. What it *wants* to
assert is that the style element has an owner, which is either a
Document or a ShadowRoot that the element is a descendant of. However,
if the element is descendant of a ShadowRoot which is itself not
connected to a document then the assertion would fail.

Instead, we use `node.is_in_a_document_tree() ||
node.is_in_a_shadow_tree()`, which more accurately reflects the intent.

Testing: This change adds the test case from
https://github.com/servo/servo/issues/37781 as a crashtest
Fixes https://github.com/servo/servo/issues/39457
Fixes https://github.com/servo/servo/issues/37781

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-23 23:00:11 +00:00
shuppy
ac8895c3ae
script: Move keyboard scrolling to script (#39371)
Instead of having every single embedder implement keyboard scrolling,
handle it in script in the default key event handler. This allows
properly targeting the scroll events to their scroll containers as well
as appropriately sizing "page up" and "page down" scroll deltas.

This change means that when you use the keyboard to scroll, the focused
or most recently clicked `<iframe>` or overflow scroll container is
scrolled, rather than the main frame.

In addition, when a particular scroll frame is larger than its content
in the axis of the scroll, the scrolling operation is chained to
the parent (as in other browsers). One exception is for `<iframe>`s,
which will be implemented in a followup change.

Testing: automated tests runnable locally with `mach test-wpt --product
servodriver`

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-09-23 20:35:08 +00:00
Andrei Volykhin
99fbd36b5d
html: Properly count <image>/<source> insertion/removal steps as the relevant mutations (#39452)
Follow the HTML specification and take into account that the HTML
`<image>/<source>` element inserting/removal steps should only be
counted as relevant mutations for `<image>` element if the parent of the
inclusive ancestor that was inserted/removed is the parent `<picture>`
element.

See <https://html.spec.whatwg.org/multipage/#relevant-mutations>.

Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/relevant-mutations.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-09-23 12:40:03 +00:00
Martin Robinson
c63311af02
script: Remove absolute positioning workaround from scrollIntoView implementation (#39441)
This isn't needed as the border box query already takes into account the
containing block chain. Instead, consistently calculate the new
scroll position for a scroller relative to its current scroll offset.

In addition, fix a small bug where the border of a scroll container was
considered part of scrollport.

Testing: A new WPT test is added.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-09-23 10:10:00 +00:00
Oriol Brufau
16d2e030eb
layout: Clamp sticky positioning offset bounds by zero (#39443)
Sticky positioning tries to keep an element visible within the nearest
scrollport. However, the element can't be offset to go beyond its
containing block. We implement this as offset bounds.

The problem was that, if the element would already be overflowing its
containing block before applying the sticky positioning, then we were
forcing it to move inside the containing block. That was wrong, and is
solved by flooring or ceiling the offset bounds by zero.

Testing: Adding new tests

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-09-23 07:22:10 +00:00
Tim van der Lippe
02aab33987
Add AbortSignal support for event listeners (#39406)
Also fixes several issues with code generation when a dom type is part
of a dictionary.

Part of #34866
Fixes #39398

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-21 18:57:10 +00:00
Tim van der Lippe
7abc813fc3
Abort fetch controller when signal is aborted (#39374)
Does not all tests pass because of a mismatch in microtask timing. The
promises are resolved/rejected in the wrong order.

Part of #34866

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-21 12:33:03 +00:00
Servo WPT Sync
016524bd3c
Sync WPT with upstream (21-09-2025) (#39414)
Automated downstream sync of changes from upstream as of 21-09-2025
[no-wpt-sync]

---------

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Co-authored-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-21 05:47:33 +00:00
Simon Wülker
2c8533f38e
Parse qualified names with non-alpha characters in xpath (#39409)
The existing parsing rules are too strict and only allow alpha and
alphanumeric characters. Instead, we should follow the production
defined in https://www.w3.org/TR/REC-xml-names/#NT-NCName.

Testing: New 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-21 03:45:04 +00:00
Simon Wülker
bbceb0faa4
Allow whitespace around path expressions in xpath (#39410)
Previously servo would allow whitespace in between components of an
xpath expression, but not around it.

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-20 22:38:24 +00:00
Simon Wülker
bdf630563c
script: Don't try to evaluate xpath variable references (#39395)
Variables in xpath via the javascript bindings are a bit mysterious, as
there is no way that a variable can be specified. We currently panic
when encountering a variable, which is not good. Instead we now throw an
error.

We keep parsing the variables because the code is already there and it
seems realistic that their behaviour will be specified in the future.
I'm fine with removing them too if that is preferred.

Testing: This behaviour is unspecified and different browser produce
different results. There is no "correct" way to do this, but we should
not crash
Part of: https://github.com/servo/servo/issues/34527

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-20 12:36:54 +00:00
Ashwin Naren
8c45428760
Enable credential management wpt tests (#39327)
Enabling them early to prevent intermittent failures.


Fixes: Partially #38788

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-09-20 07:24:32 +00:00
Ashwin Naren
8a59c2cf56
Implement indexeddb array conversion (#38288)
Implement conversion from js arrays into rust.

Testing: WPT
Fixes: None

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-09-20 06:33:16 +00:00
Oriol Brufau
0de0f741b6
layout: Ignore insets in Taffy for static and sticky positionings (#39401)
Taffy treats static and sticky positionings as relative. So the inset
properties shifted the element in the relpos way, which was no good.
It's better to just treat them as `auto` instead.

Testing: 3 existing tests pass, and adding a new one.
Fixes: #39399

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-19 20:17:56 +00:00
Oriol Brufau
994d767ae5
script: Return None for offsetParent on root <html> and all <body> elements (#39397)
We were returning null for all `<html>` elements, but now we will check
for the root element instead.

We were also returning null for "the body element", now we will return
null for all `<body>` elements even if they aren't "the body element".
This part diverges from the spec, but matches what all browsers do.
https://github.com/w3c/csswg-drafts/issues/12834

Testing: Adding new test
Fixes: #10521

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-09-19 19:38:12 +00:00
Andrei Volykhin
c017420ee7
html: Check the <source> MIME type on the source set updating (#39353)
Follow the HTML specification and check if the source element's MIME
type
('type' attribute) is supported while updating the source set of the
image element (step 5.8)
https://html.spec.whatwg.org/multipage/#update-the-source-set

Also add the missing descriptions for steps for the old and new methods:
- selecting an image source
- creating a source set from attributes
- updating the source set
- normalizing the source densities

Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/update-the-source-set.html
- resource-timing/initiator-type/picture.html

Fixes: #36675

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-09-19 18:34:37 +00:00
Simon Wülker
84577c9fd4
script: Allow reusing results from xpath queries (#39392)
This behaviour is optional, but observable. Other browsers implement it,
so we should do it too.

Testing: There are no WPT tests for this, which is fair since the spec
explicitly states implementors may choose to not reuse the result.
Fixes: Part of https://github.com/servo/servo/issues/34527

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-19 17:19:04 +00:00
Oriol Brufau
2c3d580ef1
layout: Take sticky offsets into account for offset queries (#39385)
`offsetLeft` and `offsetTop` were ignoring that sticky positioned boxes
can be shifted out of their normal position.

Testing: Various test improvements.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-09-19 14:20:15 +00:00
Oriol Brufau
754c938722
layout: Make bottom table captions obey relative positioning offsets (#39388)
#33426 only added support for relative positioning on captions with
`caption-side: top`, but forgot about `caption-side: bottom`. This
unifies the logic for both kinds of captions to avoid divergences.

Testing: Modifying an existing test to also cover this case.
Fixes: #39386

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-09-19 12:44:17 +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
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
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
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
Servo WPT Sync
b3b79e049b
Sync WPT with upstream (14-09-2025) (#39293)
Automated downstream sync of changes from upstream as of 14-09-2025
[no-wpt-sync]

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-09-14 01:44:16 +00:00
Tim van der Lippe
5beb16d671
Enable abort controller preference for fetch/api/abort (#39282)
This sets a baseline of tests for fetch-related implementation of
AbortController.

Part of #34866

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-09-13 09:14:13 +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
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
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
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