WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
131478
Move early return out of dispatch_async() block so we can return from willSendRequest quickly
https://bugs.webkit.org/show_bug.cgi?id=131478
Summary
Move early return out of dispatch_async() block so we can return from willSen...
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
Details
Formatted Diff
Diff
Patch
(4.58 KB, patch)
2014-04-10 16:04 PDT
,
Pratik Solanki
ap
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Pratik Solanki
Comment 1
2014-04-09 23:32:19 PDT
Created
attachment 229025
[details]
Patch
Pratik Solanki
Comment 2
2014-04-09 23:32:56 PDT
<
rdar://problem/16575535
>
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
Created
attachment 229084
[details]
Patch
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
Committed
r167200
: <
http://trac.webkit.org/changeset/167200
>
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