dotnet / dotnet/macios

WebPolicyDelegate binding breaks on macOS Mojave

Open
#4,214 2 comments 0 reactions 0 assignees View on GitHub
bug enhancement macOS
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

The implementation of WebPolicyDelegate in Xamarin.Mac provides default implementations that don't work on macOS Mojave DP1. When someone registers the `DecidePolicyForNavigation` event the default WebPolicyDelegate implementation is used, which also provides implementation for `DecidePolicyForMimeType` member among others. Unless the user handles the `DecidePolicyForMimeType` event it will use the default implementation and cancel any attempts to load a web page.

The fix should be as easy as adding NoDefaultValue attribute or something that will force the generator to implement RespondsToSelector for the methods depending on the assigned event handlers. I don't know how to properly unit test it though.

### Steps to reproduce
1. Create a `WebView webView = new WebView(...)`
2. Assign `DecidePolicyForNavigation = (sender, e) => WebView.DecideUse(e.DecisionToken);`.
3. Load a page by `webView.MainFrame.LoadResource(new NSUrl("https://www.bing.com"));`
4. Check that nothing was actually loaded (by the `FinishedLoad` event maybe?).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.