Commit Graph

498 Commits

Author SHA1 Message Date
Martin Robinson
e7ee1171d8 script: Remove some proprietary Servo-only testing methods from Window (#42728)
These three methods date back from the very early history of Servo and
are no longer necessary:

1. `Window.debug`: `console.log` is a better replacement for this method
   now. A manual test that tests the very basics of JavaScript used
   this. This test is removed as well.
2. `Window.gc`: This can be replaced with `TestUtils.gc`, which is part
    of a W3C specification.
3. `Window.js_backtrace`: This method is moved to `ServoTestUtils`.

Testing: Tests are updated to reflect these changes.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-02-20 17:32:34 +00:00
Luke Warlow
853fcf4fda script: Introduce ServoTestUtils and a forceLayout() function (#42714)
This introduces a new `ServoTestUtils` namespace with a `forceLayout()`
function. This `forceLayout()` function returns an object which
currently has an array of the phases ran by layout. Also moves
`panic()`, `crashHard()` and `advanceClock()` from `TestBinding` to this
new namespace.  `TestBinding` is meant to test the bindings generation,
but these are more generic helpers for Servo-only tests.

Testing: This change adds a series of Servo-only tests that verify the
behavior of the new `forceLayout()` function. Tests that rely on the
moved interfaces are updated and should continue to pass.

Signed-off-by: Luke Warlow <lwarlow@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-02-20 13:00:06 +00:00
Kingsley Yung
b6f714c73d script: Pass &mut JSContext to methods of SubtleCrypto (#42726)
This patch changes the methods of `SubtleCrypto` to use the new `&mut
JSContext` and `&mut CurrentRealm`, Those methods are `Encrypt`,
`Decrypt`, `Sign`, `Verify`, `GenerateKey`, `DeriveKey`, `DeriveBits`,
`Digest`, `ImportKey`, `ExportKey`, `WrapKey`, `UnwrapKey`,
`EncapsulateKey`, `EncapsulateBits`, `DecapsulateKey`,
`DecapsulateBits`.

The change also propagate to the all internal methods within the
`subtlecrypto` module.

Testing: Refactoring. Existing tests suffice.
Fixes: Part of #42638

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2026-02-20 11:18:29 +00:00
aquaThirsty
47bd830c8b script/dom/bluetooth: Move to &mut js::context::JSContext (#42720)
Move from `InRealm` to `&mut CurrentRealm` and from `CanGc` to `&mut
js::context::JSContext`

Testing: `/mach build`, `/mach test-unit` and `/mach test-tidy`
Fixes: Part of #42638

Signed-off-by: TimurBora <timurborisov5561@gmail.com>
2026-02-20 08:25:14 +00:00
Sam
3cde83447e script: always let cx = &mut cx in codegen and support cx in Constructor (#42712)
#42681 did not actually allowed using cx in Constructor, but it did most
heavy lifting. Now we need to pass cx to Constructor call (and skip
CanGc) if cx is requested in Bindings.conf. This PR also test this on
testbindings.

Also we now always use `let cx = &mut cx`, so we can always use just cx
(compiler will automatically deref it into &cx if needed). This is
important because codegen stuff is called from many places to it make
sense/easier to just unify this.

Testing: It compiles

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-19 08:57:40 +00:00
atbrakhi
3c8c46d32f devtools: implement pause and resume in debugger (#42580)
When a breakpoint is hit, the script thread now pauses execution and
notifies devtools clients with a "paused" event. The script
thread enters a loop that processes devtools messages until
a Resume command is received.

This change does not implement manual pause

Testing: Added new test
Fixes: part of https://github.com/servo/servo/issues/36027




https://github.com/user-attachments/assets/c619db20-4579-4f77-aa60-0e43e6e7e575

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2026-02-18 10:08:46 +00:00
Domenico Rizzo
24f2303811 script: Defers GPUComputePipeline drop to a helper struct (#42690)
Moves the drop implementation for `GPUComputePipeline` to a separate
`DroppableGPUComputePipeline` struct.

Removes `allowDropImpl` from the bindings configuration.

Testing: No tests added because of webgpu tests existent coverage
Fixes: Partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2026-02-18 04:22:50 +00:00
aquaThirsty
87ff2021a2 script: Turn scrollParent into a function and change wpt tests (#42689)
Turn `scrollParent` into a function as the CSSWG resolved in
https://github.com/w3c/csswg-drafts/issues/12731#issuecomment-3885728833

Testing: updating wpt tests
`tests/wpt/tests/css/cssom-view/scrollParent.html` and
`tests/wpt/tests/css/cssom-view/scrollParent-shadow-tree.html`
Fixes: #42547

Signed-off-by: TimurBora <timurborisov5561@gmail.com>
2026-02-17 21:21:12 +00:00
Narfinger
45eb43c1a7 canvas: Change canvas to use JSContext instead of CanGc (#42662)
This changes the methods in dom/canvas to use the new JSContext/&mut
JSContext instead of CanGc.

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

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

Testing: This is a refactor, hence, compilation is the test.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-02-17 16:12:01 +00:00
Tim van der Lippe
92e2d00083 script: Implement check for supported and enabled commands (#42634)
The first step of `execCommand` commands is to figure out
if they are supported and enabled. Therefore, implement
these two pieces with only 1 command: delete.

The implementation of `delete` is currently mostly dummy,
to have at least something going. But the main part of
this change is to setup the infrastructure to figure out
when commands are supported and enabled.

For the first part, its simply the list of commands we
currently have implemented, which is only delete.

For the second part, we need to consider the active range
of the current selection and do various checks, as well as
check the presence of `contenteditable`.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-17 13:19:41 +00:00
Sam
f623081537 script: Pass &mut JSContext to Constructor and Wrap (#42681)
Testing: Just refactor, but should be covered by WPT
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-17 13:15:24 +00:00
Tim van der Lippe
e413d45982 script: Move ImportScripts to &mut JSContext (#42665)
Part of #42638

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-17 05:37:59 +00:00
Tim van der Lippe
3665659dbe script: Move attribute-related methods to &mut JSContext (#42667)
Part of #42638

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-17 05:36:38 +00:00
Alice
00e07a6736 Bump rust version to 1.92.0 (#42661)
This is a prerequisite for using the new version of egui introduced in
https://github.com/servo/servo/pull/42402.

Testing: No new behaviour.

Signed-off-by: Alice Boxhall <alice@igalia.com>
2026-02-16 18:58:15 +00:00
Tim van der Lippe
e23c14aabd script: Implement support for contenteditable (#42633)
This is required for `document.execCommand`, since it needs to check the
active range of the selection whether it has the attribute or not.

It also turns on the relevant WPT tests, with 1
pre-existing failure for absolute positioned pseudo elements. These
currently do not render correctly, regardless of the existence of
contenteditable.

Fixes #12776

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-16 18:55:42 +00:00
Domenico Rizzo
8a16d8ca7d script: Refactors GPUComputePassEncoder to manage drop logic (#42656)
Moves the drop logic for `GPUComputePassEncoder` to a separate
`DroppableGPUComputePassEncoder` struct.

Testing: Tests that coverages webgpu just exist
Fixes: Partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2026-02-16 11:10:27 +00:00
Gae24
c13d8a2eff script: Start using &mut JSContext in devtools and webdriver code (#42640)
This is a first step to compile scripts using `&mut JSContext`.

Testing: Refactor, covered by existing WPT tests.
Part of #40600

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-02-16 08:32:08 +00:00
Sam
3283fcfb3d script: Move CSSStyleSheetMethods to &mut JSContext (#42637)
Demonstrate how to change some methods:
- [from `InRealm` to `&mut
CurrentRealm`](0132fc0fbe)
- [from `CanGc` to `&mut
JSContext`](36e5b32ee1)

Testing: Just refactor, should be covered by WPT.
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-15 15:30:27 +00:00
Tim van der Lippe
2eeaf05af9 script: Check trusted types for execCommand (#42626)
We should only do this for the `insertHTML` command.
All other commands are unaffected.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-15 12:55:05 +00:00
Tim van der Lippe
ae390d8bf8 script: Add baseline for editing/ WPT tests (#42621)
In preparation of the actual implementation.

Also had to update the codegen to be able to handle default values for
DOMString.

Part of #25005

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-14 20:36:49 +00:00
Sam
e7c35d5445 script: &mut JSContext in native functions and make them safer (#42619)
Testing: Just refactor, should be covered by WPT
Part of #40600

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-14 12:11:14 +00:00
Sam
62ae12b6a5 script: Pass &mut JSContext to timers, abort controller, some transfers and some streams (#42616)
I just wanted to do abort signal, but then this happend.

Testing: Just refactor, should be covered by WPT tests
Part of #40600

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-14 10:03:25 +00:00
Sam
d5d400c7d6 script: Use CString for Error::Type and Error::Range (#42576)
Continuation of https://github.com/servo/servo/pull/42135, switch
Error::Type and Error::Range to also use CStrings internally, as they
are converted to CString for throwing JS exceptions (other get thrown as
DomException object, which uses rust string internally).

Changes in script crate are mechanical.

Testing: Should be covered by WPT tests.
Part of #42126

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-12 15:17:30 +00:00
Onur Şahin
fb9bef66fd script: Implement DocumentOrShadowRoot.FullscreenDocument (#42401)
Implement
[DocumentOrShadowRoot.FullscreenDocument](https://fullscreen.spec.whatwg.org/#dom-document-fullscreenelement).

## Changes
- Update IDL definition by removing `Document.fullscreenElement` and
declaring it in `DocumentOrShadowRoot` mixin as per the
[spec](https://fullscreen.spec.whatwg.org/#api)
- Implement [fullscreenElement
getter](https://fullscreen.spec.whatwg.org/#dom-document-fullscreenelement)
as a method in `DocumentOrShadowroot.get_fullscreen_element` which is
used by `Document` and `ShadowRoot`.
- Changedbubble and composed flags for fullscreen enter and exit events
to true.
- Delete `shadowroot-fullscreen-element.html.ini` since the test now
passes.

## Testing
Enable `shadowroot-fullscreen-element.html` WPT test.

Passing WPT run: https://github.com/onsah/servo/actions/runs/21872882492

## Fixes
https://github.com/servo/servo/issues/42234

Signed-off-by: Onur Sahin <sahinonur2000@hotmail.com>
2026-02-12 09:55:11 +00:00
Sam
3f3c6a5d90 script: Pass more CStr(ing) instead of rust strings (#42135)
This is companion to https://github.com/servo/mozjs/pull/703 which makes
mozjs to use CStr(ing) in the API (where we would silently do conversion
in mozjs). This way we can avoid rust string -> c string allocations.

In the followup PR we should switch Error::Type and Error::Range to also
use CStrings internally, as they are converted to CString for throwing
JS exceptions (other get thrown as DomException object, which uses rust
string internally - although this gets converted to JSString somewhere).

Testing: It should be just refactor without any side effects so there
should be no changes to WPT results.
Try run: https://github.com/sagudev/servo/actions/runs/21328878448
Part of #42126

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-12 08:46:14 +00:00
Euclid Ye
62926adaaf script_bindings/libservo: Fix build script to use uv to build instead of python3 (#42532)
- Redirect stdin to null device when testing Python command. This fixes
the issue with Windows.
- Use `--frozen` for both test command and actual command used in build.
This is what we've been doing for `mach`.

Before this PR, uv fails due to the missing `--frozen` and we fall back
to python3 in CI for various platforms.

Fixes: #42527

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-02-11 11:48:36 +00:00
Domenico Rizzo
ddb31c180f script: Move GPUCommandBuffer drop logic to separate struct (#42511)
Moves the `Drop` implementation for `GPUCommandBuffer` to a separate
struct, `DroppableGPUCommandBuffer`. Updates bindings config to remove
`allowDropImpl` which is no longer needed.

Testing: No tests added
Fixes: Partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2026-02-10 17:29:36 +00:00
npiesco
70eb04d8ad fix(build): Fix Windows build hang in Python detection (#42340)
Build hangs on Windows because running `python` with no arguments in
non-TTY context waits for stdin indefinitely.

Python's behavior differs by platform:
- Linux: Detects non-TTY stdin, exits immediately
- Windows: Waits for stdin regardless, hangs forever

Fix: Add `--version` to probe so it exits immediately on all platforms.
Since `--version` is now part of the probe, return fresh Command to
prevent it from persisting into actual script invocation.

---------

Signed-off-by: npiesco <ngpiesco@gmail.com>
2026-02-10 08:37:22 +00:00
Ashwin Naren
232d434701 Add servo:config page (#40324)
Similar to about:config from firefox. All preferences are editable;
editing them mid-runtime is not guaranteed to cause any effects. This is
separate from servo:preferences, which selectively groups and exposes
preferences. This probably would become more useful if/when preferences
become persistent.

<img width="1136" height="880" alt="Screenshot 2025-10-31 at 10 19
57 PM"
src="https://github.com/user-attachments/assets/2ef759d8-06a4-457f-b9df-331cc3525338"
/>


Followup work:
- Remove `getStringPreference`, `getIntPreference`, and
`getBoolPreference`. Using `getPreference` and `preferenceType` is more
flexible.
- Make more of these config options work on the fly.
- Allow for reverting config options.

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-09 17:31:59 +00:00
atbrakhi
d6097d1967 devtools: Implement debugger Eval event (#42306)
Replace the `EvaluateJS` function to use `debugger.js` `Eval` event and
the proper context. This takes the global context and calls
[executeInGlobal](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.Object.html#executeinglobal-code-options).

In future we also add the version that takes a frame and calls
[eval](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.Frame.html#eval-code-options).

Testing: No new tests added yet, Old tests are not impacted by this
change.
Fixes: Part of https://github.com/servo/servo/issues/36027

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: eri <eri@igalia.com>
2026-02-09 12:58:51 +00:00
Oriol Brufau
e0212b38e8 Enable layout.css.attr.enabled pref for css-values tests (#42410)
The implementation of `attr()` in Stylo is not complete, but this way we
can start testing for it.

Bumps Stylo to https://github.com/servo/stylo/pull/306

Testing: Various tests pass, also a few failures. No impact on users,
even with experimental features enabled.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2026-02-08 13:51:07 +00:00
Ashwin Naren
3442a91766 indexeddb: Implement index retrieval (#42440)
Retrieve already stored indexes from the backend when querying for other
object store data.

Also removes the extraneous blocking IPC call when creating an
`IDBObjectStore` object by batching all the info into a single struct.

Testing: WPT
Fixes: #42438

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-08 09:22:50 +00:00
Ashwin Naren
7a810eda0a indexeddb: Expose keypath in idbindex (#42431)
Implements `IDBIndex.keypath`.

Testing: WPT
Fixes: Partially #38100

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-08 05:25:57 +00:00
Ashwin Naren
879f3e1451 indexeddb: IDBIndex creation and deletion (#38840)
Implements `createIndex` and `deleteIndex`, they have already been
implemented in the backend.

Testing: WPT
Fixes: Partially #38100

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-07 21:41:25 +00:00
Bryan Smith
a6a3b1a0e5 Script: Use &mut JSContext in BroadcastChannel::PostMessage (#42417)
Replace `crate::script_runtime::JSContext` with `js::context::JSContext`
in `BroadcastChannel::PostMessage` and update interface binding.

Testing: Builds and runs locally.
Part of: https://github.com/servo/servo/issues/42347

---------

Signed-off-by: BryanSmith00 <bryansmith8023@tuta.com>
2026-02-07 19:53:00 +00:00
Shubham Gupta
60fc5c3e52 script: Expose toJSON on PerformancePaintTiming (#42396)
This PR targets on adding JSON to `IDL`.

Testing: `components/servo/tests/performance_paint_timing.rs`
Fixes: Updated expectations for Existing WPT Tests.

---------

Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
2026-02-07 07:06:39 +00:00
Tim van der Lippe
cb37480071 script: Fix last remaining base element test (#42339)
This was the last failure in this directory. To fix it, I had to spelunk
into a couple of places:

1. We shouldn't use the `base_element()` of the document, but select the
first base element, regardless if it has an empty href or not
2. We didn't implement target checking for elements. Only some values
are valid and an empty target (which the test also confusingly uses) is
not valid. Hence, it should fallback to the base element
3. We weren't sanitizing the value in case it contains an ASCII tab or
newline + U+003C. This is true for both the form target as well as for
other link elements.

All in all, added a lot more specification text to figure out what was
going on.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-07 03:36:34 +00:00
TIN TUN AUNG
0fa52e7791 script_bindings: add generic type to webidl record typedefs containing dom interfaces (#42388)
when generating rust bindings for webidl typedef, the `<D>` generic Type
would not be added for record<Key, DomInterface> because
`containsDomInterface` does not take record into account. This change
add the is_Record check in `containsDomInterface`, so `typedef
record<Key, DomInterface>` can be successfully build.

Testing: Manually tested with
https://github.com/servo/servo/issues/42362, and building from scratch
with `./mach build` is successful.
Fixes: https://github.com/servo/servo/issues/42362

---------

Signed-off-by: rayguo17 <rayguo17@gmail.com>
2026-02-06 16:41:50 +00:00
Shubham Gupta
2ca7808083 script: Remove Worker scope from PerformancePaintTiming (#42409)
This will align `PerformancePaintTiming` interface according to `W3C`
specifications.

Specifiactions:
[PerformancePaintTiming](https://w3c.github.io/paint-timing/#sec-PerformancePaintTiming)

Testing: `_mozilla/mozilla/interfaces.worker.html`

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
2026-02-06 16:32:05 +00:00
pralkarz
9e02b0ce65 script: use &mut JSContext in Window::PostMessage (#42370)
Replace `crate::script_runtime::JSContext` with `js::context::JSContext`
in `Window::PostMessage`'s API.

Testing: Builds and runs locally.
Part of: https://github.com/servo/servo/issues/42347

Signed-off-by: pralkarz <pralkarz@tuta.com>
2026-02-05 20:13:11 +00:00
Gae24
97aac6e70a script: use &mut JSContext inside workers PostMessage api (#42342)
Switch `PostMessage` of `Worker`, `DedicatedWorkerGlobalScope` and
`ServiceWoker` to use `&mut JSContext`, propagating it to
`post_message_impl`.

Testing: A successful build is enough

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-02-04 18:40:32 +00:00
Steven Novaryo
42359b26a2 script: Impl UserActivation interface (#42060)
User activation is a concept used to prevents annoying usage of specific
API (Fullscreen API, Virtual Keyboard) to the user by states that the
API needs to have in order to process. This PR implements the
`UserActivation` interface and keep track of the last user interaction.
Each `Window` will keep track the [last activation time
stamp](https://html.spec.whatwg.org/multipage/interaction.html#last-activation-timestamp),
which will be set if there are a triggering input event firing in the
`Window` and propagating across the browsing contexts ancestors and
descendants. These timestamp could be consumed, and the timestamp will
be set to negative infinite.

It is then used to gate some APIs within browser that is determined as
transient activation consuming-gated APIs, which needs transient
activation to be true and consumes the activation. For the purpose of
testing, this PR would implement this behavior on fullscreen API which
is used to test activation consuming behavior.

Spec:
https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface

Testing: Existing WPT

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
2026-02-03 23:20:54 +00:00
Jonathan Schwender
b5df4bc90a mach: use uv run --frozen (#42169)
This will avoid updating the lockfile during regular operations. Also
ignore the `servo.egg-info` directory, which
the new python requirement installation mechanism via setuptools
creates.
To update the lockfile one can run `uv lock`. This is also done
automatically, when syncing requirements from WPT.

This PR also updates the uv version in CI to a newer one. If you
encounter any issues with the lockfile after this PR, it might be
necessary to update your local instance of uv.

Testing: Build still works. [mach try
full](https://github.com/servo/servo/actions/runs/21624364040)

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2026-02-03 12:43:04 +00:00
Ashwin Naren
2c96178ff1 geolocation: Support errorCallback (#42295)
Support `errorCallback` in geolocation position request functions and
throw the necessary errors.

Testing: Passes 3 more WPT tests
Fixes: Partially #38903

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-03 02:33:39 +00:00
Simon Wülker
10563019bb script: Implement HTMLInputElement.alpha (#42293)
Testing: New tests start to pass

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2026-02-02 23:38:45 +00:00
Simon Wülker
83bf475370 script: Support different colorspaces for <input type=color> (#42279)
This change adds support for the `colorspace` attribute on color inputs
and implements serialization of the input value accordingly.

The color picker from servoshell doesn't yet support non-rgb colorspaces
(and neither does the embedding API), so we convert to and from rgb when
communicating with the embedder.

Testing: New tests start to pass

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2026-02-02 06:21:41 +00:00
Simon Wülker
f822959d7e script: Add navigator.pdfViewerEnabled (#42277)
Servo doesn't have a pdf viewer, so we simply set the property to
`false`.

Testing: New tests start to pass

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2026-02-01 20:58:06 +00:00
Sam
0f9f601eb9 script: Correctly handle Reflector with AssociatedMemory and remove associated memory in finalize instead of drop (#42271)
Reviewable per commits:

As noted in
https://github.com/servo/servo/pull/42180#discussion_r2749861902
transmuting `&Reflector<AssociatedMemory>` to `&Reflector<()>` will
ignore AssociatedMemory information and thus it will not remove extra
associated memory. By returning `&Reflector<Self::ReflectorType>` from
`DomObject::reflector()` we will preserve this information and thus
correctly handle cases with associated memory. We also do not need
`overrideMemoryUsage` in bindings.conf anymore. 🎉

Instead of removing associated memory in drop code we should do it as
part of finalizers, otherwise we have problems in nested (inherited)
structs, where drop is run for both parent and child, but we only added
associated memory for child (on init_reflector) which already included
size of parent. The only exception here is promise, because it is RCed
and not finalized.

Testing: Tested locally that it fixes speedometer.
Fixes #42269

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-01 10:57:08 +00:00
Sam
6237aa4677 Merge DomObject proc-macro into #[dom_struct] (#42262)
DomObject derive should not be used standalone so let's just inline it
into dom_struct macro. This will help me with
https://github.com/servo/servo/issues/26488#issuecomment-3824301234

This should (I did not test) also improve compile times, because we do
one macro expansion less on dom_struct.

Testing: It compiles.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-01-31 18:06:25 +00:00
Euclid Ye
624e9b49e1 css: Enable registered custom properties with CSSOM but stay unanimatable (#42136)
Many websites use Tailwind CSS script which utilizes registered custom
properties.
This PR makes such websites look as expected, such as #42129.

Before: 
<img width="485" height="120" alt="image"
src="https://github.com/user-attachments/assets/428000b1-eed1-4f10-bbf8-eca9e7b630f5"
/>

After:
<img width="487" height="82" alt="image"
src="https://github.com/user-attachments/assets/ab016cbf-9c00-4bd8-adc8-be28f13e42e5"
/>


Testing: Updated existing WPT results.
Fixes: #42129
Fixes: #41417 

Stylo Companion: https://github.com/servo/stylo/pull/293

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-01-31 14:11:35 +00:00