maui icon indicating copy to clipboard operation
maui copied to clipboard

[iOS/Catalyst] Correctly call DidFinishNavigation in NavigationDelegate

Open drasticactions opened this issue 1 year ago • 2 comments

Description of Change

  • Mark MauiWKWebView DidFinishNavigation as Obsolete. This API is never being called due to the Navigation delegate overriding it, but since it's Public, someone may call it directly so they could be relying on that implementation. Marking it obsolete should at least point people to the actual implementation that's called.
  • Check for WebViewHandler in the MAUI Navigation Delegate and call ProcessNavigatedAsync. This invokes underlying Cookie syncing processes that were previously not being called unless you manually invoked "DidFinishNavigation" yourself on the "MauiWKWebView"

Issues Fixed

Fixes https://github.com/dotnet/maui/issues/20713

drasticactions avatar Feb 20 '24 12:02 drasticactions

Should this go to net9 ?

rmarinho avatar Feb 21 '24 02:02 rmarinho

Should this go to net9 ?

MauiWKWebView.DidFinishNavigation was never being called since it was originally introduced, unless someone outside of this project happened to call it manually (IMO that's unlikely, especially since it was intended to be an ObjC selector export and run automatically by the WebView.) Making it clear where your general overrides should be set (inside the navigation delegate) where that code is always being run should be safe for Main (and by extension, net8.0). Or at the very least, it wouldn't regress it further than it already has.

As for the Cookie code itself, as far as I can tell that was being tested (so it should be safe) but it wasn't run in the context of most user apps, unless someone happened to invoke that DidFinishNavigation themselves. This should work but it has more risk since this is a new codepath that most people wouldn't have hit before. I could see that maybe only being applied for net9.0, but I think the case can be made to have it everywhere.

drasticactions avatar Feb 21 '24 03:02 drasticactions

Failing tests unrelated

PureWeen avatar Feb 22 '24 03:02 PureWeen