MicrosoftEdge / MicrosoftEdge/WebView2Feedback

WebResourceRequested didn't fire anymore if WebView2 is not visible

Open
#4,697 6 comments 1 reaction 2 assignees View on GitHub

@vbryh-msft is already working on this.

Since Jul 22, 2024.

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

Description

What happened?

Hi,
I'm in trouble with a problem since I've upgrade from 110.0.1587.63 to 124.0.2478.109.
My WebView2 is registered to a custom RequestType (named "ProvideFile") and is intentionally hidden.
WebView2 control's Source is initialized to a non real uri in order to point to an external app whose is able to generate the real source when WebResourceRequested is fired with RequestType = ProvideFile.
In this way our WebView2 was able to initialize itself with all the needed bundle while it is hidden. When WebView2 will become visible the embedded application will be presented immediately.

This situation worked up to WebView2 upgrade. Now the first initialization to the non real uri generate a "chrome-error//chromewebdata/" on the DevTools title bar and the WebResourceRequested event is not fired anymore.
The WebResourceRequested fires only when an action brings up WebView2 to be visible: the embedded application will starts with a huge delay due to the bundle loading so the user experience is significantrly compromised.

In order to help consider this:

  • no other changes has occurred, except for webView2 upgrade
  • if temporarily I substitute the initial non real uri with a real uri (e.g. Microsoft site) the WebResourceRequested is fired.

I'll appreciate any help you can provide

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

124.0.2478.109

SDK Version

124.0.2478.109

Framework

Winforms

Operating System

Windows 10

OS Version

19045.4529

Repro steps

As I've explained before it is important to:
1 - Do a WebView2Helper.AddRequestDefinition with a custom "ProvideFile" request type
2 - Set Source to the uri of an app or a method able to respond with the real url
3 - In the WebResourceRequested event write a ProvideFileFromDisk method

It is sufficient for us to understand a way in order to fire WebResourceRequested event so step 1 end 2 are sufficient. If you solve the problem so WebResourceRequested event is fired I got it!

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer SDK

Last working version (if regression)

110.0.1587.63

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.