MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[feat] Add ability to open the dev tools for a particular Shared worker

Open
#1,822 3 comments 0 reactions 1 assignee View on GitHub

@aluhrs13 is already working on this.

Since Jul 18, 2022.

feature request priority-low tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
In our app, we use Shared worker, and so for debugging the app we would like to be able to easily open the shared worker dev tools window. Currently, WebView2's C++ Api only allows us to open the main window Dev tools via opendevtoolswindow - api reference

Describe the solution you'd like and alternatives you've considered

We can follow the approach that Electron exposes for debugging shared workers. There is a pair of functions, getAllSharedWorkers, which returns an ID and the URL of each shared worker registered. Then, there is a function inspectSharedWorkerById, which would open the dev tools window for that shared worker.

The electron API is here

Here is pseudocode for a sample use case:

if app.mode == DEBUG:
    shared_workers = webView2.getAllSharedWorkers()
    for [id, url] in shared_workers:
        if belongs_to_this_application(url):
            webView2.inspectSharedWorkerById(id)
            return

Alternatives
Currently our workaround is to open edge://inspect#workers, then manually click "Inspect" on the worker we want. This is ok in general, but prevents us from doing any automation which could speed up our engineering processes.

AB#36716491

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.