Bug 172460

Summary: Need a way to allow WKWebView to load request with ShouldOpenExternalURLsPolicy::ShouldAllow.
Product: WebKit Reporter: Yongjun Zhang <yongjun_zhang>
Component: WebKit2Assignee: Yongjun Zhang <yongjun_zhang>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, andersca, bdakin, beidson, commit-queue, ggaren, mitz, sam, thorton, yongjun_zhang
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch.
none
Patch, add this SPI for both iOS and macOS. none

Description Yongjun Zhang 2017-05-22 12:03:03 PDT
Currently, by default, [WKWebView loadRequest:] will set ShouldOpenExternalURLsPolicy to be ShouldNotAllow. It would be nice if a WebKit client can ask WKWebView to load request with ShouldOpenExternalURLsPolicy being ShouldAllow.
Comment 1 Yongjun Zhang 2017-05-22 12:03:30 PDT
rdar://problem/30741139
Comment 2 Yongjun Zhang 2017-05-22 12:11:04 PDT
Created attachment 310898 [details]
Patch.
Comment 3 Alex Christensen 2017-05-22 12:53:21 PDT
Comment on attachment 310898 [details]
Patch.

Sure, but I see no reason why this SPI should be iOS-only.
Comment 4 Yongjun Zhang 2017-05-22 13:40:33 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 310898 [details]
> Patch.
> 
> Sure, but I see no reason why this SPI should be iOS-only.

Currently, this is only needed for iOS. We can certainly expand this to macOS if needed in the future.

We did have the C SPI version in WKPagePrivate.h WKPageLoadURLWithShouldOpenExternalURLsPolicy, and it seems like no one is using it right now.
Comment 5 Tim Horton 2017-05-22 13:42:00 PDT
(In reply to Yongjun Zhang from comment #4)
> (In reply to Alex Christensen from comment #3)
> > Comment on attachment 310898 [details]
> > Patch.
> > 
> > Sure, but I see no reason why this SPI should be iOS-only.
> 
> Currently, this is only needed for iOS. We can certainly expand this to
> macOS if needed in the future.

This isn't how we should add things to a cross-platform framework. We should add to both platforms unless we have a good reason *not* to.

> We did have the C SPI version in WKPagePrivate.h
> WKPageLoadURLWithShouldOpenExternalURLsPolicy, and it seems like no one is
> using it right now.
Comment 6 Yongjun Zhang 2017-05-22 14:37:05 PDT
Created attachment 310922 [details]
Patch, add this SPI for both iOS and macOS.

Address review comment, adding _loadRequest:shouldOpenExternalURLs: as an SPI for both iOS and macOS.
Comment 7 WebKit Commit Bot 2017-05-22 15:41:05 PDT
Comment on attachment 310922 [details]
Patch, add this SPI for both iOS and macOS.

Clearing flags on attachment: 310922

Committed r217252: <http://trac.webkit.org/changeset/217252>
Comment 8 WebKit Commit Bot 2017-05-22 15:41:07 PDT
All reviewed patches have been landed.  Closing bug.