Commit Graph

187 Commits

Author SHA1 Message Date
Domenico Rizzo
2bcad737fa 26488 - Moves WebGLRenderingContext cleanup to a dedicated struct (#41717)
Refactors the WebGLRenderingContext to manage resource cleanup via a
dedicated `DroppableWebGLRenderingContext` struct.

Testing: This task is only a refactor, no tests added
Fixes: partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2026-01-07 04:24:17 +00:00
Wayne Van Son
5b9263690d Refactor allow to expect (#41586)
Replace `allow` with `expect` lints for `unused`, `unsafe_code`,
`dead_code`, and `non_upper_case_globals`.

Testing: So far just check it compiled on `x86_64-linux` on NixOS. Need
to use the module `system.fontconfig.enable = true;` I think in my NixOS
config.
Part of: #40383 

Searching `allow\(.*\)` for `.rs` files shows the following. for
(total_results:total_files) went from `707:386` to `675:368`, a
reduction of `32:18`.

How many files is too many files per PR? I feel like the 20-30 I have is
too big.

---------

Signed-off-by: Wayne Van Son <waynevanson@gmail.com>
2026-01-01 13:40:20 +00:00
Kingsley Yung
96ddb0bbf0 script: Implement WebCrypto encapsulation and decapsulation with ML-KEM (#41617)
Complete the ML-KEM support in WebCrypto API, with the implementation of
the "encapsulate" and "decapsulate" operations of ML-KEM, as well as
four new methods `encapsulateKey`, `encapsulateBits`, `decapsulateKey`
and `decapsulateBits` of `SubtleCrypto`.

Specification:

https://wicg.github.io/webcrypto-modern-algos/#ml-kem-operations-encapsulate

https://wicg.github.io/webcrypto-modern-algos/#ml-kem-operations-decapsulate

https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-encapsulateKey

https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-encapsulateBits

https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-decapsulateKey

https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-decapsulateBits

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

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2026-01-01 13:30:04 +00:00
Sam
d1ba789482 script: Obtain &mut JSContext at the start of the script and pass it down to msg handlers (#41564)
At the start of the script we create first (and only[^1]) safe
`JSContext`, from where we should pass it down to every code that needs
the cx. This PR brings it all the way down to message handlers. There is
clear separation between functions that use new model `&mut JSContext`
and the ones that use the old model (usually they take can_gc).

[^1]: Another place of construction are SM hooks (that pass us down raw
JSContext), but to reach that point we already needed to call another
function that takes `&mut JSContext`, so one can look at this case as
reentering/reborrowing (we derive new shorter `&mut JSContext` from the
old one).

Testing: This is just refactor, but should covered by WPT tests.
Part of #40600

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-12-30 18:19:41 +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
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
Martin Robinson
75c6dc845f stylo: Enable vendor-prefixed properties (#41350)
This changes updates to the latest version of stylo which includes
vendor-prefixed properties such as `-moz-transform` and
`-webkit-transform`. This allows more web content to render properly.

Note: Unitless perspective is not supported as part of this yet, but
will be once https://phabricator.services.mozilla.com/D274128 is part
of our downstream version of Stylo.

Testing: There are tests for this change.
Fixes: #17635.
Fixes: #14941.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-17 19:08:43 +00:00
Josh Matthews
d86d2a90aa script: Use rooted typed arrays in generated code and buffer source APIs (#41228)
There are two flavours of the mozjs `TypedArray<T>` wrapper for typed
array objects: one stores a `Box<Heap<*mut JSObject>>`, while the other
just has a bare `*mut JSObject`. The second one must only be stored
inside the `CustomAutoRoot` rooting values, but we were using it in many
other places like WebIDL dictionaries without rooting it safely. These
changes make our typed array APIs always use
`RootedTraceableBox<TypedArray<T>>` with the `Box<Heap<*mut JSObject>>`
flavour, which ensures that the JS object stored inside the typed array
wrapper is always visible to the SpiderMonkey GC.

Testing: Adds a new test that crashes without these changes.
Fixes: #41206

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-12-12 14:33:45 +00:00
Josh Matthews
d7234379dd script_bindings: Remove Drop impl exception for WebGLProgram. (#41124)
The handwritten Drop implementation was removed in #37622, so we can now
remove the exception for it.

Testing: Compile-time generated code can't be meaningfully tested.
Fixes: part of #26488

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-12-08 05:23:47 +00:00
Domenico Rizzo
34160f994c script: Move WebGLProgram Drop implementation to a member type (#37622)
Testing: No new tests introduced
Fixes: Partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-12-07 22:18:46 +00:00
Josh Matthews
c2bfb1c6c5 script_bindings: Disallow manual Drop implementations for DOM interfaces. (#40919)
This implements the solution from #26488 that prevents implementing Drop
manually for DOM interfaces, which is very easy to write in a way that
can cause memory safety errors during JS runtime teardown. Since we have
a bunch of pre-existing implementations that we are working on removing,
this PR adds an opt-out mechanism that those interfaces use.

Testing: Compile-time code generation; not possible to test.
Fixes: part of #26488

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-11-27 19:53:59 +00:00
Andrei Volykhin
cdb6c5c851 html: Use WeakRef for the MediaSession media element (#40875)
The media session is allowed to control the state of the media element
(play, pause) and is holding DOM reference, so the latest registered
media element is not be able to be GCed, so let's use the weak reference
to break this dependency.

Note that `weakReference` property was added to interfaces
- HTMLMediaElement: The `Mutable/WeakRef` requires T to be bound by
`WeakReferenceable`
- HTMLAudio/VideoElement: The `DOM_WEAK_SLOT` must be reserved by
concrete DOM JS class

Testing: No expected testing results changes

The media session UI functionality is implemented for Android and didn't
test due lack of testing sample.

Fixes: https://github.com/servo/servo/issues/40854

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-11-25 07:11:15 +00:00
Yerkebulan Tulibergenov
d0ce02a860 script: add CanGc as argument to methods in HTMLOptionElement (#40873)
script: add CanGc as argument to methods in HTMLOptionElement

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-11-25 04:41:39 +00:00
Josh Matthews
f2d13a98d9 script: Improve spec-compliance of Performance resource timing entries (#40811)
The current implementation doesn't match the specification and is broken
in a way that makes nytimes.com endlessly attempt to enqueue resource
timing entries, making the page completely unresposive to user input.
This PR makes some surgical changes that fix the NYTimes behaviour and
add some comments to make it easier to further improve the
implementation in the future.

Testing: Various WPT that used to timeout now fail instead.
Fixes: #40808

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-11-22 08:59:07 +00:00
Sam
c27f8c565a Use safe JSContext/AutoRealm/CurrentRealm in codegen (#40716)
We replace many places that use `SafeJSContext` with `JSContext` and I
also rewrote `is_platform_object_same_origin` to use new `JSContext`.
Unfortunately using wrappers2 in them causes crashes (in handle code),
so I reverted that part in last commit and will fix handles in mozjs
later.

Testing: Refactor, but it is covered by WPT tests
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-11-19 05:55:55 +00:00
Tim van der Lippe
8e0c2d5750 Implement WindowOrWorkerGlobalScope::reportError (#40654)
This web API is alternative API to `throw e`, which is why we can reuse
a lot of the existing machinery.

The one testcase that isn't passing yet is because it reports an empty
`TypeError`. The current logic in `ErrorInfo` only retrieves the message
data, but doesn't include the type of the exception. For that, we need
to use `(*report)._base.errorNumber` and map that back to the original
type codes. However, deferring that to a follow-up as that requires some
more work in mozjs.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-11-16 09:30:16 +00:00
Sam
fa12f7a5e5 script: Add cx_no_gc/cx/realm codegen option and demostrate them (#40582)
Companion to https://github.com/servo/mozjs/pull/650

We added 3 new options to bindings.conf, each more powerful then the
previous one, so one should use the least powerful as possible to keep
things flexible:
1 `cx_no_gc` prepends argument `&JSContext`, which allows creating NoGC
tokens and using functions that do not trigger GC.
2. `cx` prepends argument `&mut JSContext`, which allows everything that
previous one allows, but it also allows calling GC triggering functions.
3. `realm` prepends argument `&mut CurrentRealm`, which can be deref_mut
to `&mut JSContext` (so it can do everything that previous can), but it
also ensures that there is current entered realm, which can be used for
creation of InRealm.

next steps: #40600 

reviewable per commit

Testing: It's just refactoring
try run: https://github.com/sagudev/servo/actions/runs/19287700927

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-11-16 04:53:54 +00:00
Taym Haddadi
4658fc333a Add AbortSignal garbage collection (#40508)
Add AbortSignal garbage collection

Testing: all AbortSignal should pass.

Fixes: #40481

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-11-13 10:58:55 +00:00
Andrei Volykhin
59526928af html: Remove canGC argument from <media> internal seek method (#40587)
The `seek` method isn't explicitly exposed in the API, but is called
from various places (`currentTime`, `fastSeek`, by the `media metadata`
event) and doesn't itself create new DOM objects, so the `canGC`
argument can be omitted.

It was previously required because calling the `Seekable` method creates
a new `TimeRanges` object, but it will now be replaced by the internal
`seekable` method to avoid interaction with the JavaScript engine (and
potential garbage collector).

The `earlyest possible position` method has been changed to match the
specification and use `seekable` instead of `played`. See
https://html.spec.whatwg.org/multipage/#earliest-possible-position

Testing: No expected changes in tests

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-11-12 18:44:15 +00:00
Rocketjumper
9c05abe5f3 Fixed codegen to prevent double declaration of -webkit- prefixed CSS properties (#40549)
Removed the following on `script_bindings/codegen/run.py`:

```
# https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-webkit-cased-attribute
    if property_name.startswith("-webkit-"):
        yield "".join(camel_case(property_name, True))
```
Credits to @jdm !


Fixes: issue #40545

---------

Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
2025-11-11 03:24:06 +00:00
Taym Haddadi
28dd9f9749 Implement read looping using a read request following the spec (#39510)
Implement read looping using a read request following the spec.

Testing:  current wpt test should pass.
Fixes: #39482

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-11-09 22:05:12 +00:00
Luke Warlow
e3c4655463 Partially implement dialog.showModal() (#40405)
Partially implement dialog.showModal()

Follow-ups will be needed to further implement proper dialog
functionality but this makes a good start.

Testing: Existing WPTs cover this.

---------

Signed-off-by: Luke Warlow <lwarlow@igalia.com>
2025-11-05 15:03:13 +00:00
Taym Haddadi
6ec242580c Add CanGc argument to SafeFromJSValConvertible::safe_from_jsval (#40404)
Add CanGc argument to SafeFromJSValConvertible::safe_from_jsval
Fixes: #40392

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-11-04 20:43:59 +00:00
Luke Warlow
df7895b80a Implement Document.parseHTMLUnsafe (#40246)
Implement `Document.parseHTMLUnsafe`

Testing: Covered by existing WPTs, expectations have been updated.
Fixes: #40245

---------

Signed-off-by: Luke Warlow <lwarlow@igalia.com>
2025-10-28 21:58:35 +00:00
Yerkebulan Tulibergenov
c2f6a1b89d add CanGc as argument to methods in HTMLImageElement (#40177)
add CanGc as argument to methods in HTMLImageElement

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-27 00:06:32 +00:00
Yerkebulan Tulibergenov
1f6c4f0180 add CanGc as argument to methods in HTMLMediaElement (#40179)
add CanGc as argument to methods in HTMLMediaElement

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-26 07:48:57 +00:00
Yerkebulan Tulibergenov
aced94224e add CanGc as argument to structuredclone::read (#40157)
add CanGc as argument to structuredclone::read

Testing: These changes do not require tests because they are a refactor.
Closes https://github.com/servo/servo/issues/40154

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-25 08:53:05 +00:00
Yerkebulan Tulibergenov
132bd24c6d add CanGc as argument to Validatable.validity_state (#40155)
add CanGc as argument to Validatable.validity_state

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573.

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-25 06:06:32 +00:00
Yerkebulan Tulibergenov
92cc41abdd add CanGc as argument to key_type_to_jsval (#40153)
add CanGc as argument to key_type_to_jsval

Testing: These changes do not require tests because they are a refactor.
Closes https://github.com/servo/servo/issues/40140

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-25 05:32:40 +00:00
Josh Matthews
991ce544e1 script: Restrict scope of mutable borrow in IDBTransaction::ObjectStore. (#40139)
This avoids a borrow hazard when we create a new IDBObjectStore object
and that triggers a GC.

Testing: Many IndexedDB tests no longer crash when using a debug mozjs
build and full GC zeal. This configuration is not run in CI.
Fixes: #39946

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-10-25 01:48:49 +00:00
Yerkebulan Tulibergenov
4e418ac39a add CanGc as argument to methods in BluetoothDevice (#40147)
add CanGc as argument to methods in BluetoothDevice

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573.

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-25 00:27:43 +00:00
Yerkebulan Tulibergenov
166be9396b add CanGc as argument to methods in PaintRenderingContext2D (#40148)
add CanGc as argument to methods in PaintRenderingContext2D

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573.

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-24 22:41:14 +00:00
Yerkebulan Tulibergenov
dda8878837 add CanGc as argument to methods in Credential (#40149)
add CanGc as argument to methods in Credential

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573.

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2025-10-24 22:40:19 +00:00
Andrei Volykhin
45ed17de54 html: Add the 'name' and 'areas' IDL attributes for <map> (#40133)
Follow the HTML specification and add the missing 'name' and 'areas' IDL
attributes to HTMLMapElement.

https://html.spec.whatwg.org/multipage/#htmlmapelement

Testing: Improvements in the following WPT tests
- custom-elements/reactions/customized-builtins/HTMLMapElement.html
- html/dom/idlharness.https.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-10-24 14:19:24 +00:00
Taym Haddadi
6357fc8f1c Implement abortsignal timeout (#40032)
Implement abortsignal timeout

Testing: should pass abortsignal timeout wpt test.
Part of #36936


on top of #39994
2025-10-22 10:22:26 +00:00
Domenico Rizzo
26ec583802 script: Add CanGc to Seekable method in HtmlMediaElement (#40033)
Refactored Seekable and Seek method in HtmlMediaElement, adding CanGC
argument on all its calls.

Testing: No tests needed
Fixes: #39944

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-10-21 21:21:33 +00:00
Andrei Volykhin
65620b623d webgpu: Add the latest spec compliant GPUAdapterInfo (#39960)
According to the WebGPU specification there are some missing readonly
attributes (subgroupMinSize, subgroupMaxSize, isFallbackAdapter) for
GPUAdapterInfo IDL interface.

See https://gpuweb.github.io/gpuweb/#gpuadapterinfo

Added the new readonly attributes:
- GPUAdapter 'info' attribute
  https://gpuweb.github.io/gpuweb/#dom-gpuadapter-info
- GPUDevice 'adapterInfo' attribute
  https://gpuweb.github.io/gpuweb/#dom-gpudevice-adapterinfo

Removed marked as the deprecated the following method and attribute from
GPUAdapter interface:
- 'requestAdapterInfo' method
- 'isFallbackAdapter' attribute

Testing: Improvements in WebGPU CTS expectations
- webgpu:api,operation,adapter,info:adapter_info:*
- webgpu:api,operation,adapter,info:device_matches_adapter:*
- webgpu:api,operation,adapter,info:same_object:*
- webgpu:api,operation,adapter,info:subgroup_sizes:*
- webgpu:api,operation,adapter,requestAdapter:requestAdapter:*
- webgpu:idl,javascript:*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-10-21 17:41:36 +00:00
shuppy
3fd9ebb849 script: Make file picker selection flow asynchronous (#39893)
Previously the `<input type=file>` would wait synchronously for file
selection
results from the embedder. This change moves that synchronous wait to
the
`FileManager` worker thread. The main benefit is that script is not
blocked waiting
for the embedder. The synchronous wait on the worker thread is not a
large issue
because it is run from a thread pool, though a later change could also
remove
that synchronous wait.

In addition, the API surface for file selection changes a bit as there
is now a `dismiss`
method which differentiates between selecting no file and not making a
choice at
all.

Testing: Covered by exiting WPT, WebDriver conformance, and unit tests.

---------

Signed-off-by: delan azabani <dazabani@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-10-20 07:33:11 +00:00
Josh Matthews
94bcef54b8 script: Mark document as unsalvageable if unclosed websockets present. (#39940)
Our implementation of
https://html.spec.whatwg.org/multipage/#unloading-document-cleanup-steps
is incomplete and doesn't consider the existence of websockets. This
change corrects that, and adds a little bit more structure to the
current document unloading implementation.

Testing: New passing tests.
Fixes: #39872

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-10-18 01:54:35 +00:00
Martin Robinson
35d4b1e937 script: Combine WebDriverJSError with JavaScriptEvaluationError and add the stack (#39647)
This change merges the WebDriver only `WebDriverJSError` with the API
`JavaScriptEvaluationError` and also allows passing `ErrorInfo`
information through to the API layer when possible. In addition, the
stack is added to `ErrorInfo` (but only in situations when evaluating
JavaScript code for WebDriver or via the API for performance reasons).

These changes allow much more useful error output when script execution
fails via WebDriver. Now the error message and source file line numbers
are printed by the test executor.

Testing: These changes should be reflected in the testing output.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-10-10 11:34:42 +00:00
Narfinger
423800eec4 Script: Lazily transform the DOMString into Rust String instead of immediately. (#39509)
This implements LazyDOMString (from now on DOMString) as outlined in
https://github.com/servo/servo/issues/39479.
Constructing from a *mut JSString we keep the in a
RootedTraceableBox<Heap<*mut JSString>> and transform
the string into a rust string if necessary via the `make_rust_string`
method.
Methods used in script are implemented on this string. Currently we
transform the string at all times.
But in the future more efficient implementations are possible.

We implement the safety critical sections in a separate module
DOMStringInner which allows simple constructors, `make_rust_string` and
the `bytes` method.
This method returns the new type `EncodedBytes` which contains the
reference to the underlying string in either format.

Testing: WPT tests still seem to work, so this should test this
functionality.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-10-09 18:18:03 +00:00
Andrei Volykhin
ef9f16027b html: Add missing 'width' and 'height' reflected IDL dimension attributes (#39606)
The HTML specification defines the 'width' and 'height' attributes as
dimension attributes for the embedded content and images (img, iframe,
embed, object, video, source, input with image type)
https://html.spec.whatwg.org/multipage/#dimension-attributes and for the
tables (table, col, colgroup, thead, tbody, tfoot, tr, td, th) even
these attributes are marked as obsolete.

And UA are expected to use these 'width' and 'height' attributes as
style presentational hints for the rendering.

The embedded content and images:
https://html.spec.whatwg.org/multipage/#dimRendering

The tables:
https://html.spec.whatwg.org/multipage/#tables-2:the-table-element-4

Added missing 'width' and/or 'height' reflected IDL attributes:
- conformant 'unsigned long' IDL attributes for the 'img, source, video'
(with new macro 'make_dimension_uint*)
- obsolete 'DOMString' IDL attributes for the 'td, th, col, colgroup'

Moved the `fn attribute_affects_presentational_hints()` from Element to
specific HTML and SVG elements with attributes which affects
presentational hints for rendering.

Testing: Improvements in the following tests
- html/dom/idlharness.https.html
- html/dom/reflection-embedded.html
- html/dom/reflection-tabular.html
-
html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-10-09 18:03:47 +00:00
Tim van der Lippe
680a780552 Implement fetchLater (#39547)
Allows fetches to be deferred, only in a secure context. It does not yet
implement quota computation, since we don't have a concept of document
quota yet.

Also update the `fetch/api/idlharness` test to run in a secure context,
since this API is only available there.

Positive Mozilla position:
https://github.com/mozilla/standards-positions/issues/703
Positive WebKit position:
https://github.com/WebKit/standards-positions/issues/85

Closes whatwg/fetch#1858

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-10-02 07:51:19 +00:00
Andrei Volykhin
af74db4e92 html: Count <image> attributes state changes as the relevant mutations (#39483)
Follow the HTML specification and take into account that state changes
of the <image> 'crossorigin' and 'referrerpolicy' content attributes
(not 'crossOrigin' and 'referrerPolicy' IDL attributes) should be
counted as relevant mutations.

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

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

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-09-29 09:00:51 +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
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
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
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