Skip to content

devtools: add eval support for dedicated workers#43361

Merged
atbrakhi merged 1 commit into
servo:mainfrom
SharanRP:worker-eval
Mar 19, 2026
Merged

devtools: add eval support for dedicated workers#43361
atbrakhi merged 1 commit into
servo:mainfrom
SharanRP:worker-eval

Conversation

@SharanRP

@SharanRP SharanRP commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Added dedicated worker side handling, followed the same pattern used in main script handling by wiring worker global scope to DebuggerGlobalScope and invoking fire_eval

fixes: Part of #43317

@SharanRP SharanRP requested a review from gterzian as a code owner March 17, 2026 19:44
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 17, 2026
Signed-off-by: SharanRP <z8903830@gmail.com>
@mukilan mukilan requested review from atbrakhi and eerii and removed request for gterzian March 18, 2026 05:06
@atbrakhi

Copy link
Copy Markdown
Member

Thanks for the PR, I will review it later today :)

@atbrakhi atbrakhi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service workers are a bit more complex (see my comment below), but the changes for dedicated workers look good to me.

I’d suggest we land this PR focusing on the dedicated worker global scope first. Maybe we can remove the service worker commit from this PR and handle it in a separate one. That would also give us room to address the potential panic there.

For testing service workers locally, you might want to enable them. This is what I run on my system, since they’re not enabled by default:
RUST_LOG="error,devtools=debug" ./mach run --pref dom_serviceworker_enabled http://localhost:8000/index.html --devtools=6080

devtools_chan,
init.from_devtools_sender
.clone()
.expect("Guaranteed by ServiceWorker Constructor"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think this could lead to a panic. It looks like init.from_devtools_sender isn’t being set for service workers, so it could end up as None here.

@servo-highfive servo-highfive added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 18, 2026
@atbrakhi

Copy link
Copy Markdown
Member

You can also reproduce the panic by running:
RUST_LOG="error,devtools=debug" ./mach run --pref dom_serviceworker_enabled https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ --devtools=6080

@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Mar 19, 2026
@SharanRP

Copy link
Copy Markdown
Contributor Author

Thanks, makes sense, I split this PR to dedicated worker scope only and removed the service worker changes. I’ll open a follow-up PR for service workers and handle the from_devtools_sender/panic path there.

@atbrakhi atbrakhi changed the title devtools: add eval support for dedicated and service workers devtools: add eval support for dedicated workers Mar 19, 2026

@atbrakhi atbrakhi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Thanks.

Image

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Mar 19, 2026
@atbrakhi atbrakhi added this pull request to the merge queue Mar 19, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 19, 2026
Merged via the queue into servo:main with commit 5bb4f9f Mar 19, 2026
35 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 19, 2026
CynthiaOketch added a commit to CynthiaOketch/servo that referenced this pull request Mar 25, 2026
Service workers were invisible in the DevTools Threads panel because
serviceworker_manager.rs never sent ScriptToDevtoolsControlMsg::NewGlobal.
Send it in update_serviceworker using the browsing context, pipeline,
worker, and webview IDs, similar to how dedicated workers do it in
worker.rs.

Fixes servo#43361

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CynthiaOketch added a commit to CynthiaOketch/servo that referenced this pull request Mar 25, 2026
Service workers were invisible in the DevTools Threads panel because
serviceworker_manager.rs never sent ScriptToDevtoolsControlMsg::NewGlobal.
Send it in update_serviceworker using the browsing context, pipeline,
worker, and webview IDs, similar to how dedicated workers do it in
worker.rs.

Fixes servo#43361

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CynthiaOketch added a commit to CynthiaOketch/servo that referenced this pull request Mar 25, 2026
Service workers were invisible in the DevTools Threads panel because
serviceworker_manager.rs never sent ScriptToDevtoolsControlMsg::NewGlobal.
Send it in update_serviceworker using the browsing context, pipeline,
worker, and webview IDs, similar to how dedicated workers do it in
worker.rs.

Fixes servo#43361
CynthiaOketch added a commit to CynthiaOketch/servo that referenced this pull request Mar 25, 2026
Service workers were invisible in the DevTools Threads panel because
serviceworker_manager.rs never sent ScriptToDevtoolsControlMsg::NewGlobal.
Send it in update_serviceworker using the browsing context, pipeline,
worker, and webview IDs, similar to how dedicated workers do it in
worker.rs.

Fixes servo#43361
Gae24 pushed a commit to Gae24/servo that referenced this pull request Mar 26, 2026
Added dedicated worker side handling, followed the same pattern used in
main script handling by wiring worker global scope to
`DebuggerGlobalScope` and invoking `fire_eval`

fixes: Part of servo#43317

Signed-off-by: SharanRP <z8903830@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants