Bug 132308 - Shortcircuit shouldUseCredentialStorage callback
Summary: Shortcircuit shouldUseCredentialStorage callback
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Pratik Solanki
URL:
Keywords: InRadar
Depends on: 132543
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-28 15:59 PDT by Pratik Solanki
Modified: 2014-05-04 15:54 PDT (History)
12 users (show)

See Also:


Attachments
Patch (4.10 KB, patch)
2014-04-28 16:02 PDT, Pratik Solanki
no flags Details | Formatted Diff | Diff
Patch (9.47 KB, patch)
2014-05-01 22:52 PDT, Pratik Solanki
no flags Details | Formatted Diff | Diff
Patch (17.61 KB, patch)
2014-05-02 13:57 PDT, Pratik Solanki
ap: review+
Details | Formatted Diff | Diff
For the bots (27.67 KB, patch)
2014-05-02 17:39 PDT, Pratik Solanki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>