Closed RendijsSmukulis closed 6 months ago
@nishitha-burman, as discussed, this issue is causing widespread problems on websites and we'd very much appreciate some help on resolving it. Here are a few examples:
You can see the examples by trying the above use cases in our browser: duckduckgo.com/windows. @yildirimcagri-msft , let us know if it would be helpful to step through the issue live.
@RendijsSmukulis @pdolanjski To intercept requests from iframes, use AddWebResourceRequestedFilter with CoreWebView2WebResourceRequestSourceKinds param which should be available in release package soon. And make sure to use the filter once the new window is set.
I am currently investigating on race condition issue and will update the thread once I have a fix ready.
@monica-ch thank you for investigating this!
While the repro uses both AddWebResourceRequestedFilter and Chrome DevTools Protocol's Fetch
API, our actual application only relies on the CDP's Fetch
API.
Let us know if we can help with testing the fix in Canary or similar.
Hi @monica-ch , have you had any luck with the investigation?
Hi everyone, we fixed the issue to allow apps to run cdp messages by calling CallDevToolsProtocolMethod before new window is set in Edge Canary version 125.0.2505.0 and above.
webView.CoreWebView2.NewWindowRequested += (sender, args) =>
{
// Apply cdp messages to new window before navigation begins
// if the messages need to apply for new window navigation.
await newWebview.CoreWebView2.CallDevToolsProtocolMethodAsync(methodName);
args.NewWindow = newWebView.CoreWebView2;
args.Handled = true;
};
Please validate and let us know if you have any questions.
Please validate and let us know if you have any questions.
Thanks @monica-ch. We're working on validating against a number of examples, so we'll get back to you soon.
We have tested the changes in our app and can confirm it is working as expected. @monica-ch thank you for investigating and fixing this!
What happened?
We found a timing problem similar to script injection, but this time with web resource request handling, and it can be reproduced both with the
WebResourceRequested
event and the Chromium DevTools ProtocolFetch.requestPaused
event.The essence of the issue is the following:
Either it should be possible to set up both types of event handlers before setting NewWindow, or navigation should not start until the deferral for NewWindowRequested is completed.
Since the WebResourceRequested event is lacking in functionality compared to CDP Fetch, we especially need the Fetch method to be guaranteed to be ready to process all web requests when starting navigation in a new window.
Importance
Blocking. My app's basic functions are not working due to this issue.
Runtime Channel
Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)
Runtime Version
No response
SDK Version
No response
Framework
WPF
Operating System
Windows 10, Windows 11
OS Version
No response
Repro steps
See the repro app, please find it here with additional information in the readme: https://github.com/gkerenyi/CdpVsNewWindow
Repros in Edge Browser
Not Applicable
Regression
No, this never worked
Last working version (if regression)
No response
AB#47964385