Bug 125576

Summary: [WK2][SOUP] Fix handling of cookies when network process is enabled
Product: WebKit Reporter: Kwang Yul Seo <skyul>
Component: WebKit2Assignee: Kwang Yul Seo <skyul>
Status: RESOLVED FIXED    
Severity: Normal CC: brian.holt, cgarcia, commit-queue, gustavo, mrobinson, ossy, svillar
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 108832    
Attachments:
Description Flags
Patch
none
Patch none

Description Kwang Yul Seo 2013-12-11 07:24:16 PST
Initialize the network process with cookie accept policy, persistent storage path and type. Use WebContext::sendToNetworkingProcessRelaunchingIfNecessary instead of WebContext::sendToAllProcessesRelaunchingThemIfNecessary to send SetCookiePersistentStorage message.
Comment 1 Kwang Yul Seo 2013-12-11 07:26:20 PST
Created attachment 218962 [details]
Patch
Comment 2 WebKit Commit Bot 2013-12-11 07:27:14 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Kwang Yul Seo 2013-12-11 07:30:00 PST
Created attachment 218963 [details]
Patch
Comment 4 Kwang Yul Seo 2013-12-11 07:37:22 PST
Unfortunately, TestCookieManager.cpp: still fails:

TEST: ./Tools/gtk/../../WebKitBuild/Release/Programs/WebKit2APITests/TestCookieManager... (pid=31499)
**
ERROR:../../Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp:191:void testCookieManagerAcceptPolicy(CookieManagerTest*, gconstpointer): assertion failed (g_strv_length(domains) == 2): (1 == 2)

Further investigation shows that:
    g_assert(test->hasDomain(kFirstPartyDomain)) -> fail
    g_assert(test->hasDomain(kThirdPartyDomain)) -> pass

It seems the test becomes flaky because we can pass testCookieManagerAcceptPolicy by simply reordering the test sequence by moving WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS case to the first.
Comment 5 Carlos Garcia Campos 2013-12-28 01:47:37 PST
Comment on attachment 218963 [details]
Patch

I've tried it here locally and it works for me:

$ Programs/WebKit2APITests/TestCookieManager 
/webkit2/WebKitCookieManager/accept-policy: OK
/webkit2/WebKitCookieManager/delete-cookies: OK
/webkit2/WebKitCookieManager/cookies-changed: OK
/webkit2/WebKitCookieManager/persistent-storage: OK

$ WEBKIT_USE_NETWORK_PROCESS=1 Programs/WebKit2APITests/TestCookieManager 
/webkit2/WebKitCookieManager/accept-policy: OK
/webkit2/WebKitCookieManager/delete-cookies: OK
/webkit2/WebKitCookieManager/cookies-changed: OK
/webkit2/WebKitCookieManager/persistent-storage: OK
Comment 6 WebKit Commit Bot 2013-12-28 02:14:34 PST
Comment on attachment 218963 [details]
Patch

Clearing flags on attachment: 218963

Committed r161112: <http://trac.webkit.org/changeset/161112>
Comment 7 WebKit Commit Bot 2013-12-28 02:14:37 PST
All reviewed patches have been landed.  Closing bug.