This removes the last instances of Deref<str> and DerefMut<str> used for
DOMString.
The goal is outlined in https://github.com/servo/servo/issues/39479.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Testing: Compilation is the test as it just changes function names
essentially.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This is part of the future work of implementing LazyDOMString as
outlined in https://github.com/servo/servo/issues/39479.
We use str() method or direct implementations on DOMString for these
methods. We also change some types.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Testing: This is essentially just renaming a method and a type and
should not change functionality.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This is part of the future work of implementing LazyDOMString as
outlined in issue #39479.
We use str() method or direct implementations on DOMString for these
methods. We also change some types.
This is independent of https://github.com/servo/servo/pull/39480
Signed-off-by: Narfinger Narfinger@users.noreply.github.com
Testing: This is essentially just renaming a method and a type and
should not change functionality.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Adding an optional message to be attached to a NotFoundError.
Testing: Just a refactor
Part of #39053
---------
Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
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>
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>
Also fixes several issues with code generation when a dom type is part
of a dictionary.
Part of #34866Fixes#39398
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
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>
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>
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>
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>
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>
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>
Implement getAll and getAllKeys for IDBObjectStore.
Testing: WPT & Unit testing
Fixes: Part of #6963.
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
The spec removed all fields from CookieListItem except for name and
value
Testing: WPT tests cover this already.
Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This new API allows getting the element which establishes an element's
scroll container. This will be used to properly implement
`scrollIntoView`. There is still work to do for this API and
`offsetParent` to properly handle ancestors which are
closed-shadow-hidden from the original query element.
In addition, fix an issue where inline boxes were establishing scrolling
containers (they shouldn't do that).
Testing: There are tests for this change.
Fixes: #39096.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This clarifies the units for scrolling:
- `f32` is used for internal Servo scrolling APIs as that is the unit
used in WebRender.
- `f64` is used for the web-exposed scrolling APIs as that is what the
WebIDL code generator gives us.
Conversions are done consistently at the boundaries of the two APIs.
In addition, web-exposed scrolling methods are refactored a bit to more
closely follow the specification text. In addition, specification text
is added to those methods so that it is clearer that we are following
it.
Testing: This should not change behavior and is thus covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This will complete the type annotation on `codegen.py` so we can safely
remove the ignore from `pyproject` configurataion
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Adding an optional message to be attached to a SyntaxError. Unblocks
#39050.
The enum definition of Syntax is now `Syntax(Option<String>)`. Future
PRs should probably add more appropriate messages to some of the
`Syntax(None)`s.
Testing: Just a refactor
Fixes: Partially #39053
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This doesn't appear to make a big difference in speedometer results, but
this removes some code from the hot path of creating DomRoot values.
Before: `Score: 30.381097406624708 ± 2.0393225244958018`
After: `Score: 30.344639420871395 ± 1.9359337921154696`
Testing: Existing WPT coverage
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
These changes add a custom servo:preferences URL that allows modifying
selected preferences at runtime. The goal of this work is to make it
easy to test pages while toggling experimental web platform features,
and support quickly changing the User-Agent header.
Testing: Manually verified that spacex.com loads correctly after
changing the user agent, and that https://polygon.io/ displays grid
elements correctly and no console errors with the experimental prefs
enabled.
Fixes: #35862
<img width="1136" height="880" alt="Screenshot 2025-07-18 at 1 06 23 AM"
src="https://github.com/user-attachments/assets/2d27c321-6ca0-43c3-a347-7bc4b55272df"
/>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
In #38745, we changed the id of Frame and Window as the result of
`ToString` trait. This PR
- adapts the parsing of frame/window accordingly.
- for frame, return the
[WindowProxy](https://developer.mozilla.org/en-US/docs/Web/API/WindowProxy)
object of the iframe as it's supposed to do.
Testing: `execute_{async_}script/arguments.py`
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Add type around CG class for code generatio Web IDL in codegen.py
Testing: *Describe how this pull request is tested or why it doesn't
require tests*
Fixes: *Link to an issue this pull requests fixes or remove this line if
there is no issue*
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
The method now doesn't need unsafe in its signature because it no longer
accepts unsafe pointers as arguments. We move the unsafe marker to the
method itself.
Testing: I opened the browser and went to google.com; I ran some WPT
(IndexedDB) tests.
Fixes: #38361
---------
Signed-off-by: criskell <96352451+criskell@users.noreply.github.com>
These changes fix a large number of panics that can manifest as
intermittent test failures. They also add more specification text to
various IDBObjectStore methods and implement missing steps that check
for whether an object store is deleted.
Testing: Existing test coverage.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
We wouldn't handle the AttributeMutation::Removed for
attribute event listeners and wouldn't remove the
corresponding event listener. Added the necessary
logic (using the newly EventTarget::is_content_event_handler
to correctly only do this for known event handlers) and
added links to the relevant parts of the spec.
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This is an implementation of the `prevent_scroll` feature in the focus
transaction system. It allows to control whether focusing an element
should prevent scrolling or not.
Spec:
https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-preventscroll
Testing: Existing WPT tests
Signed-off-by: abdelrahman1234567 <abdelrahman.hossameldin.awadalla@huawei.com>
In the `IDBObjectStore::new` constructor, the `transaction` field is
initialized to null, but when using this constructor, we always execute
`set_transaction` immediately afterward. Therefore, we refactored to
require the `transaction` field to be specified during construction and
thereby also removed some no longer necessary assertions.
We also updated the `transaction` field in WebIDL to remove the nullable
capability.
Testing: WPT
Fixes: #38814
---------
Signed-off-by: criskell <96352451+criskell@users.noreply.github.com>
This PR focuses on adding type annotations to utility functions,
PropertyDefiner, and its child classes.
---------
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Additionally, several methods were updated with
spec comments. That's because the "adopt the document
from the element document" step was missing.
By adding these spec comments, I also restructured
some code to avoid duplication of mutation records
and custom element reaction queueing.
Node.textContent doesn't propagate the error yet,
as that method has a lot of separate callers of
elements that wouldn't fail. I will refactor those
in a follow-up PR to keep things manageable.
This implements part of the DOM integration from
https://github.com/whatwg/dom/pull/1268
Part of #36258
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>