Bug 147288

Summary: [GTK] Enable persistent cookie storage in MiniBrowser.
Product: WebKit Reporter: Hyungwook Lee <hyungwook.lee>
Component: WebKitGTKAssignee: Hyungwook Lee <hyungwook.lee>
Status: NEW ---    
Severity: Normal CC: bugs-noreply, mcatanzaro
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch cgarcia: review-

Description Hyungwook Lee 2015-07-24 19:46:01 PDT
I think it will be good if we support persistent cookie storage in MiniBrowser.
Comment 1 Hyungwook Lee 2015-07-24 19:58:42 PDT
Created attachment 257507 [details]
Patch
Comment 2 Michael Catanzaro 2016-01-06 20:49:11 PST
Comment on attachment 257507 [details]
Patch

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

Hi Hyungwook, why do you want this? It seems useful to me that when MiniBrowser is restarted, there are no cookies that could be affecting the results of whatever it is I'm testing. Maybe it's not likely to often cause problems in practice, though, so I'm not opposed to this change.

> Tools/MiniBrowser/gtk/main.c:298
> +    // Enable persistent cookie storage.

Please remove this comment, it's a "what" comment and doesn't add any value. We prefer comments that explain "why."
Comment 3 Hyungwook Lee 2016-01-11 21:22:37 PST
I think persistent cookie function is default function of most browser support it.

To prevent confusion of using cookie, we'd better to meet another browser's behavior even if it is mini-browser.
Comment 4 Hyungwook Lee 2016-01-11 21:45:28 PST
Created attachment 268747 [details]
Patch
Comment 5 Carlos Garcia Campos 2016-01-12 08:43:57 PST
Comment on attachment 268747 [details]
Patch

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

MiniBrowser is not a general purpose browser, it's for testing, so I'm not sure we want to save cookies. I agree it could be useful for testing cookies, though. So, maybe we could add a command line option to pass the cookies storage path, or the other way around, always save cookies and add a command line option to not use persistent cookies.

> Tools/MiniBrowser/gtk/main.c:299
> +    webkit_cookie_manager_set_persistent_storage(cookieManager, g_build_filename(g_get_user_data_dir(), "webkitgtk", "cookies.db", NULL), WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);

This is leaking the value returned by g_build_filename(), it returns a new allocated string that should be freed. Also, I don't think we should use a generic webkitgtk dir, but someting more specific like MiniBrowser.