Commit Graph

1081 Commits

Author SHA1 Message Date
Abbas Olanrewaju Sarafa
040aa2a3a5 script: Move devtools_wants_updates from GlobalScope to Window (#44121)
Moved devtools_wants_updates from GlobalScope to Window

Testing: Compiles cleanly. ```./mach test-devtools``` gives different
results each time, ```./mach test-devtools
test_sources_list_with_data_inline_classic_script``` always pass though.
Fixes: #44106

Signed-off-by: Sabb <sarafaabbas@gmail.com>
Signed-off-by: Abbas Olanrewaju Sarafa <109840351+sabbCodes@users.noreply.github.com>
2026-04-12 05:36:59 +00:00
Martin Robinson
718c8913af script/constellation: Rename and consolidate cross-Document focus messaging (#44020)
There are two times that Servo needs to ask other `Document`s to either
focus or blur.

- During processing of the "focusing steps". When a new element gains
  focus this may cause focus to be lost or gained in parent `<iframe>`s.
- When calling `focus()` on a DOM Window from another origin.

In both of these cases we need to request that a `Document` gain or lose
focus via the Constellation, but in the second case we may have a
`BrowsingContextId` of the `<iframe>` gaining focus and a
`FocusSequence`. This change splits those cases into two kinds of
messages.

Finally, run the entire focusing steps when calling `window.focus()`
instead of going to the constellation immediately. This will be
important in a followup changes where messaging order is made more
consistent.

Testing: This should not change behavior so is covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-04-09 08:59:47 +00:00
Taym Haddadi
ac4df79bd6 Make localStorage and sessionStorage throw on opaque origins (#44002)
Testing: covered by WPT test.
Fixes #43999

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2026-04-07 20:41:10 +00:00
Abubakar Abdulazeez Usman
750fb41bdb devtools: Include layer rules in CSS panel using rule tree (#43912)
DevTools was collecting CSS rules by walking stylesheets and matching
selector text. This ignored cascade order and did not correctly handle
rules inside layer blocks.

This change uses computed values (rule tree) to get the actual applied
rules in cascade order. It then maps those rules back to CSSStyleRule
using the declaration block identity, and walks the CSSOM to get
selector text and layer ancestry.

This fills ancestor_data with layer names and lets the inspector show
layered rules correctly.


Testing: 
- Verified using the minimized testcase from the issue

- Verified on https://www.sharyap.com/

- Confirmed that rules inside layer blocks are now shown with correct
order and hierarchy.


Fixes: #43541

Signed-off-by: arabson99 <arabiusman99@gmail.com>
2026-04-07 11:26:12 +00:00
Euclid Ye
0353f11ee2 script/mach: Increase stack size of ScriptThread/StyleThread to 8MiB to match recursion depth of other browsers (#43888)
TL;DR: We increase stack size of `ScriptThread` to 8MiB, and set Stylo
stack size environment var
to 8 MiB for all builds. This only reserves virtual memory space which
is
basically unlimited for 64-bit machine,
matches the recursion depth of Chromium for the example, which also uses
8MiB.

Stylo stack increase is necessary to prevent overflow when
refreshing/navigating to the example,
probably because initial load restyle incrementally but not refresh.

Testing: Added a Servo-specific test.

---
For example in #43845, we get stack overflow when we got more than 394
nested shadow roots.
For Chromium, it happens for more than 1631: 
<img width="290" height="127" alt="image"
src="https://github.com/user-attachments/assets/b3d75627-4e80-4586-9b85-4b58d8a0cd33"
/>
For Firefox, it overflows for more than 1052.

Initially I thought we didn't implement this optimally, and have
unnecessary recursion depth.
But the real reason is explained in Rust std:
> The default stack size is platform-dependent and subject to change.
Currently, it is 2 MiB on all Tier-1 platforms.

For Chromium, the visual studio dumpbin shows the stack size :
```
Dump of file C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
OPTIONAL HEADER VALUES
          800000 size of stack reserve
```
This is hex value, which is $8*16^5$, exactly 8MiB.

After we make the same change in Servo, we are fine at 1601 and
overflows at 1602.
This matches Chromium behaviour, defeating firefox, and should not
create much overhead,
as this only reserves virtual memory space: 
I tried to increase the value to 512MiB, but task manager still says
73MB RAM used,
and we won't crash even with 10000 nested shadow roots. 
But that is just for more evidence and uncalled for.

Fixes: #43845

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-04-06 03:10:11 +00:00
Tim van der Lippe
a1c8896eda script: Pass &mut JSContext to reflect_node_with_proto (#43952)
A lot (and I mean, really a lot) depends on these constructors.
Therefore, this is the one spaghetti ball that I could extract and
convert all `can_gc` to `cx`. There are some new introductions of
`temp_cx` in the callbacks of the servo parser, but we already had some
in other callbacks.

Part of #40600

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-04-05 18:07:30 +00:00
Martin Robinson
ed8576b163 script: Move all focus-related code to components/script/document/focus.rs and create DocumentFocusHandler (#43868)
This continues the work to split up the large DOM structs. In this case
we create a helper struct to store focus-related state much like
`DocumentEventHandler`.

Testing: This is mostly code motion, so should be covered by existing
tests.
Fixes: #43720

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-04-02 14:11:32 +00:00
Martin Robinson
a486ed525e script: Move "scroll into view" call out of "focusing steps" (#43842)
`HTMLOrSVGElement#focus` specifies the "scroll into view" steps should
be run after focusing. This was happening implicitly as part of the
`Document`'s implementation of the "focusing steps." That behavior is
not in the specification, so this change moves the scrolling call to
where it is specified. Along with making the code match the
specification, this change simplifies it as well.

Testing: This should not modify behavior, so existing tests should
suffice.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-04-01 21:40:13 +00:00
Martin Robinson
ceac966c34 script: Remove focus transaction concept (#43834)
For years Servo has had the concept of a focus transaction which was
used only to allow falling back to focusing the viewport when focusing a
clicked element failed. As this concept isn't part of the specification,
this change removes it.

Instead, a `FocusableArea` (a specification concept) is passed to
the `Document` focusing code. A `FocusableArea` might also be the
`Document`'s viewport.

As part of this change, some focus-related methods are moved to `Node`
from `Element` as the `Document` is not an `Element`.  This brings the
code closer to implementing the "focusing steps" from the specification.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-04-01 15:12:21 +00:00
Josh Matthews
c1bddb3801 script: Use snapshot of navigation target when navigating. (#43807)
This set of changes introduces a type matching the spec's "target
snapshot params" and uses it as part of determining the origin of new
documents. This has a side benefit of making our sandbox flag
determination more accurate, which leads to a bunch of sandboxing tests
passing as well as some new failures due to spec confusion about
origins.

Testing: Many new passing tests.
Part of the long road to #43149

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-04-01 04:45:12 +00:00
Josh Matthews
6526ee532a script: Use result of determining the origin in more cases. (#43732)
We were previously conflating the concept of a navigation request's
origin with the origin of the resulting document. These changes ensure
that the navigation request's origin is based on the navigation
initiator's origin, and the document's origin is not computed until
after the navigation response is received.

The most visible effect of these changes is that documents in sandboxed
iframes now correctly have an opaque origin.

Testing: Lots of new passing tets.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-03-28 10:03:12 +00:00
Tim van der Lippe
6656061fc3 script: Implement frame-ancestors CSP check (#43630)
Requires communication between the script thread and the constellation
to be able to retrieve the origin of a cross-origin document. However,
in the fast-path where the document resides in the same script-thread,
we use the `frame_element` instead.

If no CSP list is active, then we skip all this logic, to have a minimal
impact on document navigation.

Part of #4577
Fixes #36468

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
2026-03-28 08:54:17 +00:00
Babalola Taiwo J
ed8b28b642 script: Merge Window::load_url with ScriptThread::navigate (#43668)
Both `Window::load_url` and `ScriptThread::navigate` implement parts of
the same navigate algorithm from the HTML spec
(https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate).
`ScriptThread::navigate` had only one caller: `Window::load_url`.

This merges both methods into a single `navigate` function in
`navigation.rs`, which is the appropriate home for navigation logic. All
previous callers of `Window::load_url` now call `navigation::navigate`
directly.

Testing: This is a pure refactor with no behaviour changes, so no new
tests are needed. Existing tests cover the navigation paths affected.
Fixes: #43494

---------

Signed-off-by: thebabalola <t.babalolajoseph@gmail.com>
2026-03-27 08:38:43 +00:00
Tim van der Lippe
f340042c1d script: Pass &mut JSContext to FetchResponseListener::process_response_chunk (#43657)
Fixes #42841

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-26 18:05:24 +00:00
CynthiaOketch
9af19158f3 devtools: Show service workers in Firefox DevTools about:debugging (#43659)
This update makes service workers properly show up in DevTools and
behave more like dedicated workers.

- Added an is_service_worker field to DevtoolsPageInfo so the devtools
server can tell service workers apart from dedicated workers
- Triggered a NewGlobal message when a service worker is created in
serviceworker_manager.rs, similar to what already happens for dedicated
workers
- Routed service workers to root.service_workers so they appear under
"Service Workers" in about:debugging instead of "Other Workers"
- Implemented listServiceWorkerRegistrations with the expected response
format (activeWorker, installingWorker, waitingWorker, evaluatingWorker)
to match Firefox’s LegacyServiceWorkersWatcher
- Added support for getPushSubscription in WorkerActor, currently
returning subscription: null
Enabled the service_worker target type in the watcher’s SessionContext
and handled watchTargets("service_worker")

Testing

Start Servo with:

`RUST_LOG="error,devtools=debug" ./mach run --
--pref=dom_serviceworker_enabled --devtools=6080
"https://mdn.github.io/dom-examples/service-worker/simple-service-worker/"
`

In Firefox, go to about:debugging and connect to localhost:6080
Confirm the service worker shows up under "Service Workers"



Fixes #43574

---------

Signed-off-by: CynthiaOketch <cynthiaoketch6@gmail.com>
2026-03-26 13:53:29 +00:00
Josh Matthews
db3daa4324 script: Align javascript: URL evaluation closer to the spec. (#43496)
The commit contains several related changes:
* iframes that load javascript: URLs as part of the initial insertion
(ie. `<iframe src='javascript:...'>`) get a synchronous load event
dispatched
* javascript: URL evaluation that does not result in a string no longer
treated like a 204 response
* iframes that perform a javascript: URL navigation that does not result
in a new document no longer block the parent document load event

Testing: Lots of new tests passing.
Fixes: #24901

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-03-26 03:10:38 +00:00
Tim van der Lippe
a6722b0d1d script: Report CSP violations for child navigations in parent page (#43652)
There were two issues here:
1. We weren't firing the `load` event when we would show an error page
because of a CSP failure. This is to avoid web pages knowing wheter a
page has failed because of CSP.
2. We were reporting the violations in the wrong global. We shouldn't
fire these in the global of the child, but instead in the parent.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-26 02:11:11 +00:00
Euclid Ye
2f5e3fdb5c cargo: Rename workspace-local library starting with c to servo_* (#43622)
- canvas 
- constellation_traits
- canvas_traits
- constellation

Testing: This should not change any behaviour.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-03-25 06:04:57 +00:00
minghuaw
75a56e567b layout: Do not trigger dirty_all_nodes when web font loading fails (#43595)
Currently, the `web_font_finished_loading_callback` sends a
`ScriptThreadMessage::WebFontLoaded` message regardless of whether web
font loading succeeds or not, which leads to dirtying all nodes in
`script_thread.rs`. This creates unnecessary reflow. This PR removes the
boolean field from the `WebFontLoaded` message and only sends the
message when the web font loading is successful.

Testing: Existing WPT tests

Signed-off-by: Minghua Wu <michael.wu1107@gmail.com>
2026-03-24 08:03:30 +00:00
Euclid Ye
cae0752676 cargo: Rename workspace-local library starting with b to servo_* (#43552)
Follow up of #43526. This addresses Nico's comment:
https://github.com/servo/servo/pull/43526#issuecomment-4104953308

- `bluetooth_traits` -> `servo_bluetooth_traits`
- `base` -> `servo_base`
- `bluetooth` -> `servo_bluetooth`
- `background_hang_monitor` -> `servo_background_hang_monitor`

Testing: This should not change any behaviour.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-03-23 08:26:49 +00:00
Tim van der Lippe
01a29209b2 script: Implement support for X-Frame-Options (#43539)
We now check for this header and corresponding logic. The WPT tests
mostly pass, but rely on the `contentDocument` of the iframe to be
`null`. This is not something we did before, which means that iframes
were able to access the contents of error pages.

Instead, we now mark the document as internal with an opaque origin
according to the spec [1]. We shouldn't do this post-fact, but is
required since we first need to construct the document and enter its
realm, before we determine that it is an invalid document.

Fixes #16103

[1]:
https://html.spec.whatwg.org/multipage/document-lifecycle.html#navigate-ua-inline

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-23 06:14:27 +00:00
Gae24
5152632f04 script_bindings: Pass &mut JSContext to CustomElementReaction::invoke (#43535)
Pass `&mut JSContext` to `CustomElementReaction::invoke` and
`upgrade_element` algorithm.

Testing: A successful build is enough
Part of #40600

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-03-22 11:11:52 +00:00
Jayanta Pradhan
5ba6636555 script: add navigation and traversal task source (#43523)
script: Add navigation and traversal task source

Testing: This shouldn't be something that's observable through tests, so
a successful build is enough to verify the change.
Fixes: #43497

---------

Signed-off-by: Jayanta Pradhan <pradhanjayanta91@gmail.com>
2026-03-22 05:39:42 +00:00
Josh Matthews
5f247392be script: Move navigation origin logic into a method with spec steps. (#43491)
This pulls one bit of navigation logic out into a method that is easier
to cross-reference against the spec, and drops a bunch of custom logic
that is better served by the existing LoadOrigin infrastructure.

Testing: Existing WPT coverage is sufficient.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-03-21 12:26:35 +00:00
Tim van der Lippe
8f699b1f17 script: Pass &mut JSContext to submit_timing_data (#43479)
Part of #40600

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-20 15:31:46 +00:00
Tim van der Lippe
1933769eb2 script: Pass &mut JSContext to devtools (#43480)
Part of #40600

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-20 13:53:27 +00:00
Tim van der Lippe
dc9e442b17 script: Pass &mut JSContext to Location (#43481)
Part of #42638

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-20 12:54:38 +00:00
Tim van der Lippe
3d4cfa4718 net: Remove process_request_eof (#43477)
This is no longer present in the spec. Instead, the
`process_request_body` is the new way. These two
methods were called right after each other and there was only 1
implementation in `htmlvideoelement`. That implementation is now moved
to `process_request_body` and hence we can remove the unnecessary
method.

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-20 10:51:33 +00:00
Narfinger
81c3bde86c script: Move easy IpcChannel usage to GenericChannel usage (#43309)
This moves some easy elements in Script from IpcChannel and related
methods to GenericChannel and related methods and some callbacks.

Testing: This will be covered by WPT if the channels behave differently.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-03-20 07:24:25 +00:00
shuppy
4dbc9f7af9 libservo: Per-webview accessibility activation (#43029)
in #42336, we added a
[Servo](https://doc.servo.org/servo/struct.Servo.html)-global API for
controlling whether accessibility is active. the idea was that when the
embedder activates accessibility, all webviews and documents activate
accessibility and start sending AccessKit tree updates, and vice versa
when they deactivate.

we found a problem with this approach in #42338. global activation of
accessibility makes it too easy to accidentally cause a panic in
AccessKit, and harder than it needs to be for embedders to learn that
they are responsible for grafting each webview’s subtree into their main
AccessKit tree as soon as accessibility is activated. this is due to an
invariant of the AccessKit subtree API: if a subtree starts sending
updates before the graft node is created, the program panics.

this patch reworks accessibility activation to make it per-webview. by
requiring embedders to explicitly activate accessibility for a webview,
we can communicate the AccessKit invariant via our API docs.

Testing: this patch includes an initial accessibility test in libservo
Fixes: part of #4344, extracted from our work in #42338

---------

Signed-off-by: Alice Boxhall <alice@igalia.com>
Signed-off-by: delan azabani <dazabani@igalia.com>
Co-authored-by: Alice Boxhall <alice@igalia.com>
2026-03-19 08:44:24 +00:00
Javier Olaechea
eea60b8eb1 script: Pass &mut JSContext to FetchResponseListener::process_response (#43259)
Add the cx parameter to `fn process_response` in the
`FetchResponseListener` trait and the traits that that interface change
requires. Chose to add it as the first parameter, following the same
order that `FetchResponseListener::process_response_eof` uses.

Testing: Checked that servo builds locally as well as `./mach fmt` and
`./mach test-tidy`. I don't think more tests are needed as we are not
introducing new functionality
Fixes: #42840

---------

Signed-off-by: Javier Olaechea <pirata@gmail.com>
2026-03-19 06:22:00 +00:00
atbrakhi
a27ab5ae55 devtools: Remove EvaluateJS in favor of Eval (#43316)
The console actor sends `Eval` via debugger.js, not `EvaluateJS`.
Workers only handled `EvaluateJS` which was never sent. We would want to
use `Eval` for workers as well. The worker evaluation was already
non-functional.

One more motivation behind not keeping this legacy path is because it
requires passing `None` for all new fields added to
`EvaluateJSReplyValue`, that is extra burden.

Testing: All existing tests are passing.

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2026-03-16 12:45:32 +00:00
Euclid Ye
709e8d5548 script: Skip RAII guard and early return when input event queue is empty (#43301)
This is a hot path:
- there is a lot of processing in `handle_pending_input_events`: JS
realm entry, temporary variable creation, value assignment etc.
- we acquire a RAII guard before calling the function.

If the event queue is empty, this would result in unnecessary overhead
on the hot path.
We skip all above work in this case.

Testing: This is an optimization that should not change visible
behaviour,
thus covered by all the testdriver tests.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-03-16 07:15:20 +00:00
Simon Martin
23a23f41ae script: remove redundant ScriptWindowProxies method (#43276)
ScriptWindowProxies's find_window_proxy and get methods are exactly the
same; remove the latter.

Testing:  Existing WPT tests should cover the script_thread.rs change
Fixes: https://github.com/servo/servo/issues/43251

Signed-off-by: Simon Martin <simon@nasilyan.com>
2026-03-15 08:53:29 +00:00
Tim van der Lippe
3c852261b9 script: Pass &mut JSContext in CSP code (#43184)
Part of #40600

Testing: it compiles

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
2026-03-14 21:42:02 +00:00
Gae24
e8b581aaf0 script: Pass &mut JSContext in more places (#43252)
Continuation of #43220, removes many `temp_cx` calls introduced by that.

Testing: No behaviour change, a successful build is enough.
Fixes: #43241 #43240

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-03-14 10:03:48 +00:00
Tim van der Lippe
af256bd6e5 script: Check for render-blocking documents before continuing (#43150)
The spec expects us to check for render blocking (among some other
state) before we start procesing a document. Therefore, add those checks
and also check in the
stylesheet loader that we should only do so when we are allowed to do
so.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-03-13 09:54:03 +00:00
Martin Robinson
5fec1395c9 prefs: Move Opts::print_pwm to DiagnosticsLogging::progressive_web_metrics (#43209)
This option controls whether progressive web metrics are printed to the
system console, which is essentially the purpose of
`DiagnosticsLogging`. This makes the API a bit more uniform.

Testing: We do not really have automated testing for this kind of
feature of the API.
Fixes: This is part of #34967.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-03-13 09:45:39 +00:00
Simon Wülker
c0ff7c1fc9 Everywhere: Remove instances of clippy::redundant-clone (#43212)
This change fixes all instances where
[`clippy::redundant-clone`](https://rust-lang.github.io/rust-clippy/master/index.html?groups=complexity%2Ccorrectness%2Cnursery%2Csuspicious&levels=allow#redundant_clone)
would trigger. It's allowed by default

I've also changed the lint to warn-by-default for servo.

Testing: Covered by WPT

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2026-03-12 13:28:21 +00:00
eri
f53a259216 devtools: Handle getEnvironment message (#43167)
Initial work to support scopes in the debugger. They don't show at the
moment since we are not processing variables yet. Depends on #43166.

Testing: Ran `mach test-devtools` and manual testing.
Part of: #36027

Signed-off-by: eri <eri@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2026-03-12 13:13:03 +00:00
Euclid Ye
0153f2ff0a embedder_traits: Upgrade InputEventHandled to InputEventsHandled to batch IPC response (#43169)
We send back input events handling results in batch. This reduces IPC,
and make the following **TODO** possible in a follow-up.

Testing: I hope existing tests results won't change.
Part of
https://github.com/servo/servo/issues/43136#issuecomment-4031915873
**TODO**: We have not done 
> collect ids and send back a reply for each of them once the coalesced
event has been handled.

yet.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-03-11 10:14:25 +00:00
Gae24
bc1cd2ceeb script: bump mozjs to use SpiderMonkey 140.8 and set more compile options (#43020)
Set `mutedErrors_`, `noScriptRval`, `isRunOnce` compile options.

Testing: A test now passes
Part of #38378

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-03-10 17:02:19 +00:00
Brent Schroeter
4c69d856f6 tools: Support tab navigation via navigateTo, goBack, and goForward (#43026)
Add support for navigation requests ("navigateTo", "goBack", and
"goForward") over the Remote Debugging Protocol. These may be sent by a
UI client in response to user input (for example the address bar in the
Firefox inspector), or they can be used to automate navigation during
unit tests.

This currently only supports navigation within the URL domain at which
servoshell is initially launched, due to a bug in servo's
`BrowsingContextActor` implementation. (Unit tests covering a fix for
that issue will depend on this change.)

Testing: The behavior of all 3 new message types is covered by a new
test case—`test_navigation`—in the devtools unit test suite.
Fixes: #38668

---------

Signed-off-by: Brent Schroeter <contact@brentsch.com>
Co-authored-by: eri <eri@igalia.com>
2026-03-06 09:13:39 +00:00
atbrakhi
9a915ece22 devtools: Pass ListFrames back to devtools (#43039)
Pass `ListFrames` back to devtools

Testing: existing test passes
Fixes: part of #36027

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: eri <eri@igalia.com>
2026-03-06 08:47:15 +00:00
atbrakhi
1b7ec96fb6 devtools: implement listing all frames (#43015)
This change implements listing all frames from youngest to oldest. This
is in order to send correct frame message from thread actor

This is needed for our upcoming work!

Testing: Current tests are passing + manual test
Fixes: #36027

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: eri <eri@igalia.com>
2026-03-05 14:58:30 +00:00
Martin Robinson
b47b39f974 script: Distinguish between sequential (keyboard) and click focusability (#43019)
This changes makes it so that keyboard and click focusability are two
separate concepts in `script`. Some elements may be focusable only by
the keyboard and some only by the click events.

In addition, the `SEQUENTIALLY_FOCUSABLE` `Node` flag is removed in
favor of a
more specification-aligned approach of checking lazily if an element is
a focusable area. This allows moving the focus fixup steps to their
correct place, asynchronously during "update the rendering" and
synchronously during `unbind_from_tree`.

Testing: This causes some WPT tests to start passing and some to start
failing:
- Two subtests tests in
`tests/wpt/meta/css/css-conditional/container-queries/` because
we do not implement support for container queries. These are legitimate
failures
   and they are compensated by a good subtest pass in the same file.
- A few subtests in `/html/interaction/focus/tabindex-focus-flag.html`
because now
we do not allow focusing non-rendering elements. The failures are HTML
elements with
`<svg>` which we do not rendering and `<summary>` elements of
`<details>` which
   need special handling we do not implement yet.
- `html/semantics/forms/the-fieldset-element/disabled-003.html`: Some of
these tests
start to fail, but they are not spec compliant and browser properly
implementing
   the asynchronous focus fixup rule also fail them. 

Fixes: #31870.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2026-03-05 08:58:59 +00:00
Josh Matthews
f206571869 layout: Prevent DomRefCell::borrow from being used in layout code (#42976)
DomRefCell::borrow inside of layout code is risky because it leads to
memory races if the code is ever called from layout worker threads. This
can be caught via TSAN, but we can also catch it deterministically in CI
by using our existing thread state debug assertions correctly.

Testing: Existing WPT test coverage is sufficient.
Fixes: #42962

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-03-04 06:44:39 +00:00
atbrakhi
630e4b75da devtools: Implement frame scoped evaluation (#42936)
When paused at a breakpoint, hovering over local variables now shows
their value. Previously `eval` used `executeInGlobal()` which could not
access local scope, so hovering showed `ReferenceError` instead of the
actual value.


https://github.com/user-attachments/assets/05247b82-4e4d-422d-a428-63e46b55d55f

Testing: Added a new test
Fixes: Part #36027

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2026-03-03 14:22:25 +00:00
eri
88f2469270 devtools: Implement initial support for Step in, Step out and Step over (#42907)
We are adding initial support for stepping in the debugger. Step over
mostly works, but Step in and Step out have some quirks that we are
working on.

![2026-02-27
12-32-05](https://github.com/user-attachments/assets/0b73b32c-efa3-444c-80a4-f863a64b6fdc)

Testing: DevTools tests and manual checks.
Part of: #36027

Signed-off-by: eri <eri@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2026-03-02 18:35:02 +00:00
webbeef
1ad41dc15f script: Add a ServoInternals.garbageCollectAllContexts() (#42798)
This is useful in about:memory to measure memory usage after running the
GC.

The calling page sends a callback to the constellation that in turn wait
for all script threads to run the GC and report back.

Testing: Manual testing in `about:memory`

Before running GC:

<img width="2048" height="1480" alt="Screenshot from 2026-02-23
18-50-46"
src="https://github.com/user-attachments/assets/fd8399c1-fbc7-4f4c-886d-f29629ef8369"
/>

After running GC:

<img width="2048" height="1480" alt="Screenshot from 2026-02-23
18-51-00"
src="https://github.com/user-attachments/assets/82c793f7-8229-4de4-9cb5-47c94383b410"
/>

Signed-off-by: webbeef <me@webbeef.org>
2026-02-28 08:38:32 +00:00