Bug 69386 - REGRESSION: Curious Location of StorageTracker.db
Summary: REGRESSION: Curious Location of StorageTracker.db
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.6
: P1 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2011-10-04 16:55 PDT by Martin Stricker
Modified: 2011-10-05 14:39 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.01 KB, patch)
2011-10-05 13:46 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Now with more thread-safe\! (2.90 KB, patch)
2011-10-05 14:22 PDT, David Kilzer (:ddkilzer)
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Stricker 2011-10-04 16:55:30 PDT
WebKit Version 5.1 (6534.50, r96515)

Since a few days, WebKit on Mac 10.6.8 creates StorageTracker.db at '/~/Library/Safari/LocalStorage/StorageTracker.db' (directory literally named "~" at root).

Also, extensions like Adblock reinstall on each browser startup.
Comment 1 Martin Stricker 2011-10-04 17:06:26 PDT
This only happens when extensions like Adblock (http://safariadblock.com) are used.
Comment 2 Alexey Proskuryakov 2011-10-04 21:45:34 PDT
<rdar://problem/10235680>
Comment 3 Alexey Proskuryakov 2011-10-04 21:47:51 PDT
<http://trac.webkit.org/changeset/96255> is a suspicious change.
Comment 4 José Pedro Sousa do Amaral 2011-10-05 09:13:36 PDT
I can confirm this bug. In my case, it does not seem to be caused by AdBlock, for I disabled AdBlock and the bug persisted. However when I disabled _all_ extensions, the misplaced StorageTracker.db was no longer created.

5.1 (6534.50, r96636)
Comment 5 David Kilzer (:ddkilzer) 2011-10-05 13:46:09 PDT
Created attachment 109853 [details]
Patch
Comment 6 Alexey Proskuryakov 2011-10-05 13:51:15 PDT
Comment on attachment 109853 [details]
Patch

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

> Source/WebKit/mac/Storage/WebStorageManager.mm:93
>      static NSString *sLocalStoragePath;

Is this code only ever running on main thread?

> Source/WebKit/mac/Storage/WebStorageManager.mm:98
>      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

I wonder why it's reading defaults every time, not just on initialization.

> Source/WebKit/mac/Storage/WebStorageManager.mm:105
> +    sLocalStoragePath = [[sLocalStoragePath stringByStandardizingPath] retain];

This code will retain each time, but the function is not a "copy" one.
Comment 7 Alexey Proskuryakov 2011-10-05 13:57:11 PDT
Comment on attachment 109853 [details]
Patch

My bad. I didn't notice the early return (we usually use a different pattern in WebCore, something like 

static NSString *sLocalStoragePath = calculateStoragePath();
Comment 8 David Kilzer (:ddkilzer) 2011-10-05 14:22:33 PDT
Created attachment 109862 [details]
Now with more thread-safe\!
Comment 9 Alexey Proskuryakov 2011-10-05 14:25:44 PDT
Comment on attachment 109862 [details]
Now with more thread-safe\!

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

I don't know if thread safety is a real issue for this function, but the patch looks good.

> Source/WebKit/mac/Storage/WebStorageManager.mm:35
> +#import <pthread.h>
>  #import <WebCore/SecurityOrigin.h>
>  #import <WebCore/StorageTracker.h>

Alphabetically, upper case comes first.
Comment 10 David Kilzer (:ddkilzer) 2011-10-05 14:39:21 PDT
Committed r96748: <http://trac.webkit.org/changeset/96748>