Bug 216977 - Add -[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:] to provide a way to allow app link
Summary: Add -[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:] to provide a way ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2020-09-25 09:11 PDT by Hoa Dinh
Modified: 2020-10-24 09:11 PDT (History)
3 users (show)

See Also:

Patch (3.43 KB, patch)
2020-09-25 09:19 PDT, Hoa Dinh
no flags Details | Formatted Diff | Diff
Patch (4.75 KB, patch)
2020-09-25 22:43 PDT, Hoa Dinh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hoa Dinh 2020-09-25 09:11:58 PDT
We need to add an additional parameter to WKPageLoadURLRequestReturningNavigation() to control whether app link is allowed to be used.
Comment 1 Hoa Dinh 2020-09-25 09:19:23 PDT
Created attachment 409699 [details]
Comment 2 Alex Christensen 2020-09-25 11:06:41 PDT
Comment on attachment 409699 [details]

WKPageLoadURLRequestReturningNavigation should not be changed, to keep binary compatibility.  This should be new SPI, and it should be ObjC in WKWebViewPrivate.h
Comment 3 Alex Christensen 2020-09-25 11:40:29 PDT
It looks like what we need is something similar to _loadRequest:shouldOpenExternalURLs: but that uses ShouldAllowExternalSchemesButNotAppLinks
Comment 4 Hoa Dinh 2020-09-25 22:43:30 PDT
Created attachment 409770 [details]
Comment 5 EWS 2020-09-25 23:48:37 PDT
Committed r267619: <https://trac.webkit.org/changeset/267619>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409770 [details].
Comment 6 Radar WebKit Bug Importer 2020-09-25 23:49:18 PDT
Comment 7 Darin Adler 2020-09-26 15:09:37 PDT
Comment on attachment 409770 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=409770&action=review

> Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:157
>  - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL;
>  - (WKNavigation *)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType characterEncodingName:(NSString *)characterEncodingName baseURL:(NSURL *)baseURL userData:(id)userData WK_API_AVAILABLE(macos(10.12), ios(10.0));
>  - (WKNavigation *)_loadRequest:(NSURLRequest *)request shouldOpenExternalURLs:(BOOL)shouldOpenExternalURLs WK_API_AVAILABLE(macos(10.13), ios(11.0));
> +- (WKNavigation *)_loadRequest:(NSURLRequest *)request shouldOpenExternalURLsPolicy:(_WKShouldOpenExternalURLsPolicy)shouldOpenExternalURLsPolicy WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));

Why is all of this SPI instead of API? Don’t we want some of this as API?
Comment 8 Alex Christensen 2020-10-24 09:11:51 PDT
This control has been requested, but I don't think this location is where it should go in public API.  I think it should be a WKNavigationDelegate callback asking whether we should open a particular link.