Bug 132308

Summary: Shortcircuit shouldUseCredentialStorage callback
Product: WebKit Reporter: Pratik Solanki <psolanki>
Component: PlatformAssignee: Pratik Solanki <psolanki>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, beidson, berto, cdumez, cgarcia, commit-queue, danw, gustavo, kling, mitz, mrobinson, psolanki
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 132543    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
ap: review+
For the bots none

Description Pratik Solanki 2014-04-28 15:59:13 PDT
If we are going to tell CFNetwork to use the credential storage then we don't really need a callback from them. Default answer is true.
Comment 1 Pratik Solanki 2014-04-28 16:02:58 PDT
Created attachment 230330 [details]
Patch
Comment 2 Brady Eidson 2014-04-28 16:29:47 PDT
Comment on attachment 230330 [details]
Patch

Why is this important for ResourceHandleCF but not ResourceHandleMac?
Comment 3 Pratik Solanki 2014-04-28 17:03:43 PDT
(In reply to comment #2)
> (From update of attachment 230330 [details])
> Why is this important for ResourceHandleCF but not ResourceHandleMac?

How would we do this for ResourceHandleMac? How do we dynamically remove the objc method -[WebCoreResourceHandleAsOperationQueueDelegate connectionShouldUseCredentialStorage:]? We should do it for ResourceHandleMac if it is possible.
Comment 4 Pratik Solanki 2014-04-28 17:41:10 PDT
Comment on attachment 230330 [details]
Patch

Marking for review again unless someone has an idea for how to do this for ResourceHandleMac.
Comment 5 Brady Eidson 2014-04-28 18:22:50 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > (From update of attachment 230330 [details] [details])
> > Why is this important for ResourceHandleCF but not ResourceHandleMac?
> 
> How would we do this for ResourceHandleMac? How do we dynamically remove the objc method -[WebCoreResourceHandleAsOperationQueueDelegate connectionShouldUseCredentialStorage:]? We should do it for ResourceHandleMac if it is possible.

You don't dynamically *remove* the objective-C method.

You either dynamically *add* the method (which is possible, if not a little dirty), or you have a base-class delegate without the method, then subclass to add the method, and choose which class to instantiate.
Comment 6 Brady Eidson 2014-04-28 18:23:16 PDT
Comment on attachment 230330 [details]
Patch

I listed two ways this could be done for Mac in a comment.
Comment 7 Pratik Solanki 2014-05-01 22:52:43 PDT
Created attachment 230653 [details]
Patch
Comment 8 Alexey Proskuryakov 2014-05-02 10:20:37 PDT
Comment on attachment 230653 [details]
Patch

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

> Source/WebCore/ChangeLog:4
> +        Shortcircuit shouldUseCredentialStorage callback
> +        https://bugs.webkit.org/show_bug.cgi?id=132308

This looks like a good idea to me.

The code is very confusing, so I think that this change should balance that by cleaning up at least some of the cruft right away. In particular, shouldn't shouldUseCredentialStorageAsync be eliminated? As we hardcode the answer (in NetworkProcess) by either providing or not providing a callback, all this complicated machinery is essentially dead code.

> Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:338
> +- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection

This function looks like it should always return NO (or YES? I'm confused).

Is there a reason to still jump to the main thread?
Comment 9 Pratik Solanki 2014-05-02 13:29:58 PDT
Comment on attachment 230653 [details]
Patch

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

>> Source/WebCore/ChangeLog:4
>> +        https://bugs.webkit.org/show_bug.cgi?id=132308
> 
> This looks like a good idea to me.
> 
> The code is very confusing, so I think that this change should balance that by cleaning up at least some of the cruft right away. In particular, shouldn't shouldUseCredentialStorageAsync be eliminated? As we hardcode the answer (in NetworkProcess) by either providing or not providing a callback, all this complicated machinery is essentially dead code.

That's true. I realized that and was going to do in a  followup path but maybe I can just clean this up now. Will definitely be easier.

>> Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:338
>> +- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection
> 
> This function looks like it should always return NO (or YES? I'm confused).
> 
> Is there a reason to still jump to the main thread?

Yeah, we don't need to jump to main thread. We can just return NO.
Comment 10 Pratik Solanki 2014-05-02 13:57:10 PDT
Created attachment 230694 [details]
Patch
Comment 11 Alexey Proskuryakov 2014-05-02 14:56:42 PDT
Comment on attachment 230694 [details]
Patch

r=me

Please unbreak the builds before landing.
Comment 12 Pratik Solanki 2014-05-02 17:39:00 PDT
Created attachment 230723 [details]
For the bots

Updated patch for the bots. I also removed continueShouldUseCredentialStorage() with this version.
Comment 13 Pratik Solanki 2014-05-03 17:06:24 PDT
<rdar://problem/16806708>
Comment 14 Pratik Solanki 2014-05-03 17:18:04 PDT
Committed r168232: <http://trac.webkit.org/changeset/168232>
Comment 15 Andreas Kling 2014-05-03 22:42:30 PDT
Mavericks WK2 Debug is crashing on a couple of tests after this change:
http://build.webkit.org/builders/Apple%20Mavericks%20Debug%20WK2%20%28Tests%29/builds/4408

Could you take a look, or should we roll it out?
Comment 16 WebKit Commit Bot 2014-05-03 23:24:20 PDT
Re-opened since this is blocked by bug 132543
Comment 17 Pratik Solanki 2014-05-04 15:54:26 PDT
Committed r168248: <http://trac.webkit.org/changeset/168248>