WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 147871
[Cocoa] Add redirect support to CustomProtocolManager
https://bugs.webkit.org/show_bug.cgi?id=147871
Summary
[Cocoa] Add redirect support to CustomProtocolManager
Andy Estes
Reported
2015-08-11 00:00:52 PDT
[Cocoa] Add redirect support to CustomProtocolManager
Attachments
Patch
(15.32 KB, patch)
2015-08-11 00:23 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(16.32 KB, patch)
2015-08-11 13:52 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(16.19 KB, patch)
2015-08-11 13:55 PDT
,
Andy Estes
mitz: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Andy Estes
Comment 1
2015-08-11 00:19:47 PDT
This is needed to write a test for
https://bugs.webkit.org/show_bug.cgi?id=147872
Andy Estes
Comment 2
2015-08-11 00:23:07 PDT
Created
attachment 258709
[details]
Patch
Andy Estes
Comment 3
2015-08-11 13:52:06 PDT
Created
attachment 258750
[details]
Patch
Andy Estes
Comment 4
2015-08-11 13:55:57 PDT
Created
attachment 258751
[details]
Patch
mitz
Comment 5
2015-08-15 10:19:14 PDT
Comment on
attachment 258751
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258751&action=review
> Source/WebKit2/Shared/Network/CustomProtocols/Cocoa/CustomProtocolManagerCocoa.mm:54 > +using namespace WebCore;
I think recently in WebKit2 we have taken to avoiding using namespace WebCore. It sure looks like existing functions in this file already use WebCore::-qualified types.
> Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:110 > +{
Do we need a notImplemented() here?
Alexey Proskuryakov
Comment 6
2015-08-15 12:56:49 PDT
Comment on
attachment 258751
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258751&action=review
> Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:116 > + if (redirectResponse) { > + _connection->send(Messages::CustomProtocolManager::WasRedirectedToRequest(_customProtocolID, request, redirectResponse), 0); > + return nil; > + }
For normal loading, -connection:willSendRequest:redirectResponse: needs to return "request" if the delegate agrees to take the redirect, nil if the request is canceled, and some other request if the delegate decides to modify it. Is it a bug to return nil here, or do custom protocols work differently? If it's a bug, please add a test case that would have caught it.
Andy Estes
Comment 7
2015-08-15 19:32:59 PDT
(In reply to
comment #5
)
> Comment on
attachment 258751
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=258751&action=review
> > > Source/WebKit2/Shared/Network/CustomProtocols/Cocoa/CustomProtocolManagerCocoa.mm:54 > > +using namespace WebCore; > > I think recently in WebKit2 we have taken to avoiding using namespace > WebCore. It sure looks like existing functions in this file already use > WebCore::-qualified types.
Oh, ok. I was actually going to remove all the WebCore::s in another patch, so that's good to know!
> > > Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:110 > > +{ > > Do we need a notImplemented() here?
I can add it. Thanks for the review!
Andy Estes
Comment 8
2015-08-15 19:49:09 PDT
(In reply to
comment #6
)
> Comment on
attachment 258751
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=258751&action=review
> > > Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:116 > > + if (redirectResponse) { > > + _connection->send(Messages::CustomProtocolManager::WasRedirectedToRequest(_customProtocolID, request, redirectResponse), 0); > > + return nil; > > + } > > For normal loading, -connection:willSendRequest:redirectResponse: needs to > return "request" if the delegate agrees to take the redirect, nil if the > request is canceled, and some other request if the delegate decides to > modify it. > > Is it a bug to return nil here, or do custom protocols work differently? If > it's a bug, please add a test case that would have caught it.
Custom protocols do work differently in this case. If I were to return the request here, then the connection would tell the embedder's NSURLProtocol to start loading the redirect request. Then, when the Networking process receives WasRedirectedToRequest, it starts a redirect for the underlying connection, which triggers our normal willSendRequest() logic. If this results in a new request, then the Networking process's NSURLProtocol receives -startLoading, which starts a new connection in the UI process. So returning nil here prevents duplicate loads from starting in the embedder's NSURLProtocol, and ensures that the request that is started is the one that WebKit has had a chance to modify.
Andy Estes
Comment 9
2015-08-15 20:29:25 PDT
Committed
r188517
: <
http://trac.webkit.org/changeset/188517
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug