Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebResourceRequested event no longer fires if you register a second callback #36

Closed
wravery opened this issue Aug 16, 2019 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@wravery
Copy link

wravery commented Aug 16, 2019

I'm adding Accept-Language headers to all outgoing requests, using code that looks like this:

webview->add_WebResourceRequested(nullptr, nullptr, 0, Microsoft::WRL::Callback<IWebView2WebResourceRequestedEventHandler>(
		[](IWebView2WebView* webview, IWebView2WebResourceRequestedEventArgs* args)
	{
		...
	}).Get(), &token);

It worked before, but now it's no longer calling the lambda function, and the header is not showing up in the Network dev tool. I'm on Canary with the following file versions/timestamps:

  • WebView2Loader.dll, 0.08.230.0, 7/25/2019 8:51 PM
  • embeddedbrowserwebview.dll, 78.00.246.0, 8/12/2019 9:44 PM
@wravery
Copy link
Author

wravery commented Aug 16, 2019

Just checked the Dev channel and it repros there too. Maybe related to the recent bump to Chromium 78?

  • embeddedbrowserwebview.dll, 78.00.244.0, 8/8/2019 8:58 PM

@david-risney
Copy link
Contributor

Thanks for the great details. I'll see if I can observe this behavior as well and investigate.

@david-risney david-risney added the bug Something isn't working label Aug 16, 2019
@wravery
Copy link
Author

wravery commented Aug 17, 2019

It turns out this was triggered by a change on my end. I was trying to use two different callbacks with different URI patterns for different purposes. Registering the second one for a specific URI pattern seems to have overridden the registration for this one.

I think this might still be a bug, since the matching add_WebRequestReceived and remove_WebRequestReceived methods use an EventRegistrationToken for correlation. That implies to me that you can have distinct registrations with different callbacks and all of them which match the URI pattern should be invoked. I haven't tested the other events with matching add_/remove_ methods but I think the same reasoning applies if they behave the same way.

@wravery wravery changed the title WebResourceRequested event no longer fires WebResourceRequested event no longer fires if you register a second callback Aug 17, 2019
@pagoe-msft
Copy link

Happy to report that we just shipped updates to our WebResourceRequested Event in 0.8.355. Closing the issue for now and feel free to re-open the issue and let us know if you have additional feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants