Bug 131478

Summary: Move early return out of dispatch_async() block so we can return from willSendRequest quickly
Product: WebKit Reporter: Pratik Solanki <psolanki>
Component: New BugsAssignee: Pratik Solanki <psolanki>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, benjamin, kling, psolanki
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch ap: review+

Pratik Solanki
Reported 2014-04-09 23:28:20 PDT
Move early return out of dispatch_async() block so we can return from willSendRequest quickly
Attachments
Patch (2.96 KB, patch)
2014-04-09 23:32 PDT, Pratik Solanki
no flags
Patch (4.58 KB, patch)
2014-04-10 16:04 PDT, Pratik Solanki
ap: review+
Pratik Solanki
Comment 1 2014-04-09 23:32:19 PDT
Pratik Solanki
Comment 2 2014-04-09 23:32:56 PDT
Alexey Proskuryakov
Comment 3 2014-04-09 23:49:30 PDT
Comment on attachment 229025 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=229025&action=review > Source/WebCore/ChangeLog:9 > + We can do a check for redirect response on the dispatch queue and return from willSendRequest synthesizeRedirectResponseIfNecessary uses ResourceRequest class, which is not thread safe. The Foundation version of this function doesn't do that, so it's safe to call on a secondary thread. Good catch though, perhaps we can refactor the code to make this fix work.
Pratik Solanki
Comment 4 2014-04-10 16:04:39 PDT
Pratik Solanki
Comment 5 2014-04-10 16:09:12 PDT
(In reply to comment #4) > Created an attachment (id=229084) [details] > Patch Maybe something like this would work? We save the scheme from the request and do a quick comparison and early return if they match.
Alexey Proskuryakov
Comment 6 2014-04-10 17:30:32 PDT
Comment on attachment 229084 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=229084&action=review I'm not sure if we need to follow the Mac pattern with secondary threads at all - it looks like CFURLConnection may have all the async delegates we could wish for. If that's feasible, that should be much better, and would make this patch unnecessary. > Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:86 > + if (!originalRedirectResponse) { > + RetainPtr<CFStringRef> newScheme = adoptCF(CFURLCopyScheme(CFURLRequestGetURL(cfRequest))); > + if (CFStringCompare(newScheme.get(), m_originalScheme.get(), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { > + CFRetain(cfRequest); > + return cfRequest; > + } > + } Shouldn't this code be removed from synthesizeRedirectResponseIfNecessary() now? Would also be good to move a comment about HSTS here.
Pratik Solanki
Comment 7 2014-04-10 18:04:34 PDT
Comment on attachment 229084 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=229084&action=review >> Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:86 >> + } > > Shouldn't this code be removed from synthesizeRedirectResponseIfNecessary() now? > > Would also be good to move a comment about HSTS here. Yes, I can remove the code from synthesizeRedirectResponseIfNecessary() and I'll addd a comment.
Pratik Solanki
Comment 8 2014-04-10 22:05:10 PDT
(In reply to comment #6) > (From update of attachment 229084 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=229084&action=review > > I'm not sure if we need to follow the Mac pattern with secondary threads at all - it looks like CFURLConnection may have all the async delegates we could wish for. > > If that's feasible, that should be much better, and would make this patch unnecessary. I'll take a look at this next.
Pratik Solanki
Comment 9 2014-04-13 12:18:24 PDT
(In reply to comment #7) > (From update of attachment 229084 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=229084&action=review > > >> Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:86 > >> + } > > > > Shouldn't this code be removed from synthesizeRedirectResponseIfNecessary() now? > > > > Would also be good to move a comment about HSTS here. > > Yes, I can remove the code from synthesizeRedirectResponseIfNecessary() and I'll addd a comment. SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest() calls synthesizeRedirectResponseIfNecessary() as well so I can't remove the code. I'll leave it in for now.
Pratik Solanki
Comment 10 2014-04-13 12:20:51 PDT
Note You need to log in before you can comment on or make changes to this bug.