Bug 50780 - WebKit2: Need to be able to set and get the Cookie Storage Policy
Summary: WebKit2: Need to be able to set and get the Cookie Storage Policy
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jessie Berlin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-12-09 12:41 PST by Jessie Berlin
Modified: 2011-04-14 09:24 PDT (History)
3 users (show)

See Also:


Attachments
Patch (Part 1) - Getting and setting the policy in WebKit2 (34.70 KB, patch)
2011-03-24 09:38 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff
Patch (Part 1) - Getting and setting the policy in WebKit2 (Take 2) (56.41 KB, patch)
2011-03-25 08:37 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff
Patch (Part 1) - Getting and setting the policy in WebKit2 (Take 3) (51.31 KB, patch)
2011-03-25 10:30 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff
Patch (Part 2) - Make it possible to specify the initial policy on Windows (8.11 KB, patch)
2011-03-25 13:49 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jessie Berlin 2010-12-09 12:41:03 PST
It should be similar to the WebKit1 cookieStorageAcceptPolicy/setCookieStorageAcceptPolicy.

<rdar://problem/8750856>
Comment 1 Jessie Berlin 2011-03-10 11:08:49 PST
It doesn't have to be a preference. It should probably be done on the WKCookieManager instead.
Comment 2 Jessie Berlin 2011-03-24 09:38:25 PDT
Created attachment 86784 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2
Comment 3 Darin Adler 2011-03-24 10:17:32 PDT
Comment on attachment 86784 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2

I’m not sure WebCore should be involved so much here. It’s right to have WebKit2 send the cookie acceptance policy from the UI to the Web process, but I’m not sure we need the platform layer inside WebCore involved in communicating this to the networking code in a platform-independent way.

It seems to me that WebKit2 code can directly call setHTTPCookieAcceptPolicyOnAllCookieStorages for the CFNetwork case and we need not introduce this concept for all the other networking layers unless there really is a cross-platform need for this.
Comment 4 Jessie Berlin 2011-03-24 10:32:46 PDT
(In reply to comment #3)
> (From update of attachment 86784 [details])
> I’m not sure WebCore should be involved so much here. It’s right to have WebKit2 send the cookie acceptance policy from the UI to the Web process, but I’m not sure we need the platform layer inside WebCore involved in communicating this to the networking code in a platform-independent way.
> 
> It seems to me that WebKit2 code can directly call setHTTPCookieAcceptPolicyOnAllCookieStorages for the CFNetwork case and we need not introduce this concept for all the other networking layers unless there really is a cross-platform need for this.

The reason I went with getting and setting the policy in WebCore is that we get the list of hostnames in WebCore that have cookies associated with them and delete cookies associated with specific hostnames in WebCore (necessary for other platforms that still use WebKit1 API).

Another minor point is this approach  allows for WebCore to keep whether or not Private Browsing is enabled a detail that the WebCookieManager doesn't need to know about.

However, I do not have very strong feelings on this and could be persuaded that keeping as much of it as possible in the WebKit2 layer is the best way to go. One question that I am not quite sure about - as other ports adopt WebKit2, won't they need to introduce this concept for their networking layers anyways since they will have to implement this API?
Comment 5 Jessie Berlin 2011-03-24 13:06:14 PDT
Comment on attachment 86784 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2

I am going to take another pass at this that avoids having to give separate implementations for all of the different platforms when the only implementations that will really be used are the CFNetwork and Mac ones.
Comment 6 Jessie Berlin 2011-03-25 08:37:06 PDT
Created attachment 86947 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2 (Take 2)
Comment 7 Jessie Berlin 2011-03-25 09:41:57 PDT
Comment on attachment 86947 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2 (Take 2)

Per discussion with Anders on IRC, it would be better to have more of this done entirely in WebKit2 (instead of doing the actual setting and getting in WebCore). I will rework it and send out another patch.
Comment 8 Jessie Berlin 2011-03-25 10:30:09 PDT
Created attachment 86955 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2 (Take 3)
Comment 9 Jessie Berlin 2011-03-25 12:33:11 PDT
Comment on attachment 86955 [details]
Patch (Part 1) - Getting and setting the policy in WebKit2 (Take 3)

Committed with a Mac build fix in http://trac.webkit.org/changeset/81980
Comment 10 Jessie Berlin 2011-03-25 13:49:06 PDT
Created attachment 86978 [details]
Patch (Part 2) - Make it possible to specify the initial policy on Windows
Comment 11 Jessie Berlin 2011-04-14 09:24:13 PDT
Comment on attachment 86978 [details]
Patch (Part 2) - Make it possible to specify the initial policy on Windows

Committed in http://trac.webkit.org/changeset/81997