MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: Synchronizing Tab States with Extension Scripts in a Multi-tab Browser Developed with C# WebView2

Open
#4,607 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

I have developed a multi-tab browser using C# WebView2. For each new tab created, a WebView2 instance is instantiated. Suppose I created 3 instances. In the extension script, I use:

chrome.tabs.query({active: true}, function(tabs) {
console.log(tabs);
});

to query the current active tab. Normally, it should only return the information of the active tab object, but the problem is that after executing the query, it returns 3 tab information entries that correspond to the previous 3 WebView2 instances, and all objects have the active property set to true, which is obviously incorrect.
image

Is this a bug in WebView2? Could anyone please help analyze this? Thank you very much.

I hope that when a new WebView2 instance is created, the display state of the WebView2 instance can be synchronized within the extension environment. The version of WebView2 I am using is 1.0.2535.41.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.0.2535.41

SDK Version

No response

Framework

WPF

Operating System

Windows 10

OS Version

No response

Repro steps

As long as multiple instances are created in C#, no matter which instance is visible, when querying through the extension script with:
chrome.tabs.query({active: true}, function(tabs) {
console.log(tabs);
});

it returns all instances and all of them have active set to true.
image

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

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.

Research direction

No repository files or tests are named. Start with the repro steps using multiple C# WebView2 instances and the chrome.tabs.query({active: true}) extension call, then compare the returned tab states with the visible instance. Done means determining whether this behavior is expected and documenting the supported synchronization or a confirmed WebView2 defect.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.