Bug 176481

Summary: [WK2] Notify client when downloads are redirected
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, buildbot, commit-queue, ggaren, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews105 for mac-elcapitan-wk2
none
Archive of layout-test-results from ews126 for ios-simulator-wk2
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Chris Dumez 2017-09-06 16:36:08 PDT
We should notify client when downloads are redirected. The client has currently no way of knowing.
Comment 1 Chris Dumez 2017-09-06 16:40:23 PDT
Created attachment 320078 [details]
Patch
Comment 2 Build Bot 2017-09-06 17:54:12 PDT
Comment on attachment 320078 [details]
Patch

Attachment 320078 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/4469115

New failing tests:
http/tests/download/anchor-download-redirect.html
Comment 3 Build Bot 2017-09-06 17:54:13 PDT
Created attachment 320084 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 4 Build Bot 2017-09-06 18:20:41 PDT
Comment on attachment 320078 [details]
Patch

Attachment 320078 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4469201

New failing tests:
http/tests/download/anchor-download-redirect.html
Comment 5 Build Bot 2017-09-06 18:20:43 PDT
Created attachment 320087 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 6 Chris Dumez 2017-09-06 18:51:37 PDT
Created attachment 320089 [details]
Patch
Comment 7 Chris Dumez 2017-09-06 18:53:33 PDT
Created attachment 320090 [details]
Patch
Comment 8 Chris Dumez 2017-09-06 22:06:39 PDT
Created attachment 320095 [details]
Patch
Comment 9 Chris Dumez 2017-09-07 09:49:52 PDT
<rdar://problem/34309065>
Comment 10 Chris Dumez 2017-09-07 10:17:54 PDT
Created attachment 320126 [details]
Patch
Comment 11 Geoffrey Garen 2017-09-07 10:35:50 PDT
Comment on attachment 320126 [details]
Patch

The API is called "...ClientRedirect...". What does the client see for server redirects?
Comment 12 Chris Dumez 2017-09-07 10:40:18 PDT
(In reply to Geoffrey Garen from comment #11)
> Comment on attachment 320126 [details]
> Patch
> 
> The API is called "...ClientRedirect...". What does the client see for
> server redirects?

Hmm. I think this is badly named. We notify the client of HTTP server redirects.
Comment 13 Chris Dumez 2017-09-07 10:41:26 PDT
(In reply to Chris Dumez from comment #12)
> (In reply to Geoffrey Garen from comment #11)
> > Comment on attachment 320126 [details]
> > Patch
> > 
> > The API is called "...ClientRedirect...". What does the client see for
> > server redirects?
> 
> Hmm. I think this is badly named. We notify the client of HTTP server
> redirects.

The equivalent delegate for navigation is named:
didReceiveServerRedirectForProvisionalNavigation
Comment 14 Chris Dumez 2017-09-07 10:43:47 PDT
(In reply to Chris Dumez from comment #13)
> (In reply to Chris Dumez from comment #12)
> > (In reply to Geoffrey Garen from comment #11)
> > > Comment on attachment 320126 [details]
> > > Patch
> > > 
> > > The API is called "...ClientRedirect...". What does the client see for
> > > server redirects?
> > 
> > Hmm. I think this is badly named. We notify the client of HTTP server
> > redirects.
> 
> The equivalent delegate for navigation is named:
> didReceiveServerRedirectForProvisionalNavigation

What do you think about calling the delegate: "didReceiveServerRedirect" ?
Comment 15 Chris Dumez 2017-09-07 10:55:59 PDT
(In reply to Chris Dumez from comment #14)
> (In reply to Chris Dumez from comment #13)
> > (In reply to Chris Dumez from comment #12)
> > > (In reply to Geoffrey Garen from comment #11)
> > > > Comment on attachment 320126 [details]
> > > > Patch
> > > > 
> > > > The API is called "...ClientRedirect...". What does the client see for
> > > > server redirects?
> > > 
> > > Hmm. I think this is badly named. We notify the client of HTTP server
> > > redirects.
> > 
> > The equivalent delegate for navigation is named:
> > didReceiveServerRedirectForProvisionalNavigation
> 
> What do you think about calling the delegate: "didReceiveServerRedirect" ?

Or didReceiveServerRedirectToURL
Comment 16 Chris Dumez 2017-09-07 11:32:38 PDT
Created attachment 320145 [details]
Patch
Comment 17 Geoffrey Garen 2017-09-07 11:36:29 PDT
> What do you think about calling the delegate: "didReceiveServerRedirect" ?

I like didReceiveServerRedirect.

I would leave off "ToURL" because the other names in this group leave off their direct objects as well.
Comment 18 Chris Dumez 2017-09-07 11:41:35 PDT
Comment on attachment 320145 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/_WKDownloadDelegate.h:37
> +- (void)_download:(_WKDownload *)download didReceiveServerRedirectToURL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));

How about for the ObC API. Do you also prefer to omit the "toURL" suffix?

It seems other delegates do provide the name for the parameter, e.g.:
- (void)_download:(_WKDownload *)download didFailWithError:(NSError *)error;
- (NSString *)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename allowOverwrite:(BOOL *)allowOverwrite;
- (void)_download:(_WKDownload *)download didReceiveResponse:(NSURLResponse *)response;
Comment 19 Chris Dumez 2017-09-07 11:53:17 PDT
Created attachment 320150 [details]
Patch
Comment 20 Geoffrey Garen 2017-09-07 11:56:06 PDT
> > Source/WebKit/UIProcess/API/Cocoa/_WKDownloadDelegate.h:37
> > +- (void)_download:(_WKDownload *)download didReceiveServerRedirectToURL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
> 
> How about for the ObC API. Do you also prefer to omit the "toURL" suffix?

A related API in LegacyWebKit is named "willPerformClientRedirectToURL...".

I like ToURL for the ObjC API. It's a little more Cocoa-y to name your direct object (as you pointed out too).
Comment 21 Chris Dumez 2017-09-07 12:02:50 PDT
Created attachment 320152 [details]
Patch
Comment 22 Geoffrey Garen 2017-09-07 12:08:37 PDT
Comment on attachment 320152 [details]
Patch

r=me
Comment 23 WebKit Commit Bot 2017-09-07 12:52:01 PDT
Comment on attachment 320152 [details]
Patch

Clearing flags on attachment: 320152

Committed r221749: <http://trac.webkit.org/changeset/221749>
Comment 24 WebKit Commit Bot 2017-09-07 12:52:03 PDT
All reviewed patches have been landed.  Closing bug.