Bug 70680 - [WK2][GTK] Application cache directory is incorrectly set
Summary: [WK2][GTK] Application cache directory is incorrectly set
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 69523
  Show dependency treegraph
 
Reported: 2011-10-22 07:12 PDT by Zan Dobersek
Modified: 2011-11-08 01:07 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.47 KB, patch)
2011-10-22 07:17 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Now the appcache directory most likely looks something like ~/.cache/webkitgtk/applications (1.58 KB, patch)
2011-11-07 23:05 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2011-10-22 07:12:08 PDT
In WebProcess::initializeWebProcess the appcache directory of the cache storage is set from the applicationCacheDirectory parameter that is set in WebContext::ensureProcess. Unluckily this parameter holds the return value of WebContext::applicationCacheDirectory() which returns the current cache directory of the cache storage. So it's basically setting an empty string as the directory, which is wrong.

In WebKit1 the appcache directory is set to be the same as for the web databases - "g_get_user_data_dir()/webkit/databases". The same should be done in WebKit2.
Comment 1 Zan Dobersek 2011-10-22 07:17:37 PDT
Created attachment 112089 [details]
Patch
Comment 2 Philippe Normand 2011-11-02 06:43:00 PDT
Not sure why it's been done like this in WebKit1 but storing application cache data in a databases directory seems odd. Can we use a new directory for this? At least in WebKit2?
Comment 3 Martin Robinson 2011-11-02 09:54:29 PDT
For reference Chromium stores this information for me at ~/.config/chromium/Default/Application Cache.
Comment 4 Zan Dobersek 2011-11-06 23:57:19 PST
(In reply to comment #3)
> For reference Chromium stores this information for me at ~/.config/chromium/Default/Application Cache.

I then propose for application cache directory path to be constructed this way:

> g_build_filename(g_get_user_data_dir(), "webkit", "applicationcache", NULL);

Once an agreement is made about which name to use, I'll upload a new patch.
Comment 5 Martin Robinson 2011-11-07 00:00:24 PST
(In reply to comment #4)
> (In reply to comment #3)
> > For reference Chromium stores this information for me at ~/.config/chromium/Default/Application Cache.
> 
> I then propose for application cache directory path to be constructed this way:
> 
> > g_build_filename(g_get_user_data_dir(), "webkit", "applicationcache", NULL);
> 
> Once an agreement is made about which name to use, I'll upload a new patch.

Shouldn't it be something like this?

g_build_filename(g_get_user_cache_dir(), "webkitgtk", "applications", NULL);

or

g_build_filename(g_get_user_cache_dir(), "webkitgtk", "applicationcache", NULL);
Comment 6 Zan Dobersek 2011-11-07 00:11:05 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > For reference Chromium stores this information for me at ~/.config/chromium/Default/Application Cache.
> > 
> > I then propose for application cache directory path to be constructed this way:
> > 
> > > g_build_filename(g_get_user_data_dir(), "webkit", "applicationcache", NULL);
> > 
> > Once an agreement is made about which name to use, I'll upload a new patch.
> 
> Shouldn't it be something like this?
> 
> g_build_filename(g_get_user_cache_dir(), "webkitgtk", "applications", NULL);
> 
> or
> 
> g_build_filename(g_get_user_cache_dir(), "webkitgtk", "applicationcache", NULL);

You're right, this sort of data should be put into user's cache directory. Regarding the name of bottom directory, I'd prefer 'applications' or perhaps nothing, simply putting cached data into ~/.cache/webkitgtk (if application cache is the only cached data). Repeating the word 'cache' in the path is not helpful.

Just to note, this again shows just how wrong it is that WebKit1 puts appcache into database directory. If there's interest/need, I can open another bug.
Comment 7 Martin Robinson 2011-11-07 09:05:37 PST
(In reply to comment #6)

> Just to note, this again shows just how wrong it is that WebKit1 puts appcache into database directory. If there's interest/need, I can open another bug.

Yeah, I thnk we should fix both WebKit1 and WebKit2. The name of top-level directory should be "webkitgtk" too, since we no longer pretend to be the only game in town.
Comment 8 Zan Dobersek 2011-11-07 23:05:39 PST
Created attachment 113995 [details]
Now the appcache directory most likely looks something like ~/.cache/webkitgtk/applications
Comment 9 Zan Dobersek 2011-11-07 23:07:28 PST
(In reply to comment #8)
> Created an attachment (id=113995) [details]
> Now the appcache directory most likely looks something like ~/.cache/webkitgtk/applications

Sorry for the long name, mixed up flags when uploading through webkit-patch.
Comment 10 Philippe Normand 2011-11-07 23:58:57 PST
Comment on attachment 113995 [details]
Now the appcache directory most likely looks something like ~/.cache/webkitgtk/applications

Thanks Zan!
Comment 11 Martin Robinson 2011-11-08 00:05:48 PST
(In reply to comment #10)
> (From update of attachment 113995 [details])
> Thanks Zan!

Zan do you mind also changing the WebKit2 database directory to relfect the new "webkitgtk" name? I don't think we can in WebKit1, because it's an API break.
Comment 12 WebKit Review Bot 2011-11-08 01:07:44 PST
Comment on attachment 113995 [details]
Now the appcache directory most likely looks something like ~/.cache/webkitgtk/applications

Clearing flags on attachment: 113995

Committed r99537: <http://trac.webkit.org/changeset/99537>
Comment 13 WebKit Review Bot 2011-11-08 01:07:48 PST
All reviewed patches have been landed.  Closing bug.