Bug 165502

Summary: [iOS] WKWebView should not allow app links to be opened on back or forward navigation
Product: WebKit Reporter: Chelsea Pugh <cpugh>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, cpugh, mitz, sam
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch for [iOS] WKWebView should not allow app links to be opened on back or forward navigation
none
Patch (with style fixed) for [iOS] WKWebView should not allow app links to be opened on back or forward navigation
none
v2 patch for [iOS] WKWebView should not allow app links to be opened on back or forward navigation none

Description Chelsea Pugh 2016-12-06 17:01:24 PST
WKWebView should not allow app links to be opened on back or forward navigation
Comment 1 Chelsea Pugh 2016-12-06 17:15:38 PST
Created attachment 296356 [details]
Patch for [iOS] WKWebView should not allow app links to be opened on back or forward navigation
Comment 2 WebKit Commit Bot 2016-12-06 17:16:43 PST
Attachment 296356 [details] did not pass style-queue:


ERROR: Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldNotOpenAppLinksOnBackForwardNavigation.mm:30:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chelsea Pugh 2016-12-06 17:21:53 PST
Created attachment 296357 [details]
Patch (with style fixed) for [iOS] WKWebView should not allow app links to be opened on back or forward navigation
Comment 4 Sam Weinig 2016-12-07 14:51:44 PST
Comment on attachment 296357 [details]
Patch (with style fixed) for [iOS] WKWebView should not allow app links to be opened on back or forward navigation

I wonder if a better way to do this would be to update API::NavigationAction::shouldOpenAppLinks() to check that navigationType is not NavigationType::BackForward.  I'm actually not sure, Dan?
Comment 5 mitz 2016-12-07 14:58:02 PST
(In reply to comment #4)
> Comment on attachment 296357 [details]
> Patch (with style fixed) for [iOS] WKWebView should not allow app links to
> be opened on back or forward navigation
> 
> I wonder if a better way to do this would be to update
> API::NavigationAction::shouldOpenAppLinks() to check that navigationType is
> not NavigationType::BackForward.  I'm actually not sure, Dan?

That’s possible, but that would be encoding (admittedly trivial) policy logic into what is currently a data container. I think, however, that WebPageProxy::decidePolicyForNavigationAction, which is where we currently initialize the NavigationAction, would be a good place to implement this policy. I agree that setting the m_shouldSuppressAppLinksInNextNavigationPolicyDecision in advance is unnecessarily complex and fragile.
Comment 6 Sam Weinig 2016-12-07 18:01:49 PST
(In reply to comment #5)
> (In reply to comment #4)
> > Comment on attachment 296357 [details]
> > Patch (with style fixed) for [iOS] WKWebView should not allow app links to
> > be opened on back or forward navigation
> > 
> > I wonder if a better way to do this would be to update
> > API::NavigationAction::shouldOpenAppLinks() to check that navigationType is
> > not NavigationType::BackForward.  I'm actually not sure, Dan?
> 
> That’s possible, but that would be encoding (admittedly trivial) policy
> logic into what is currently a data container. I think, however, that
> WebPageProxy::decidePolicyForNavigationAction, which is where we currently
> initialize the NavigationAction, would be a good place to implement this
> policy. I agree that setting the
> m_shouldSuppressAppLinksInNextNavigationPolicyDecision in advance is
> unnecessarily complex and fragile.

One thing I am also not sure of is what history.back()/history.forward()/history.go() should/would here. Probably worth testing.
Comment 7 Chelsea Pugh 2016-12-07 18:16:05 PST
Created attachment 296457 [details]
v2 patch for [iOS] WKWebView should not allow app links to be opened on back or forward navigation
Comment 8 WebKit Commit Bot 2016-12-08 14:50:56 PST
Comment on attachment 296457 [details]
v2 patch for [iOS] WKWebView should not allow app links to be opened on back or forward navigation

Clearing flags on attachment: 296457

Committed r209573: <http://trac.webkit.org/changeset/209573>
Comment 9 WebKit Commit Bot 2016-12-08 14:51:00 PST
All reviewed patches have been landed.  Closing bug.