Bug 116346 - WKKeyValueStorageManagerGetKeyValueStorageOrigins should get origins from the UI process
Summary: WKKeyValueStorageManagerGetKeyValueStorageOrigins should get origins from the...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-17 13:17 PDT by Anders Carlsson
Modified: 2013-05-17 21:46 PDT (History)
3 users (show)

See Also:


Attachments
Patch (12.47 KB, patch)
2013-05-17 13:21 PDT, Anders Carlsson
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2013-05-17 13:17:45 PDT
WKKeyValueStorageManagerGetKeyValueStorageOrigins should get origins from the UI process
Comment 1 Anders Carlsson 2013-05-17 13:21:42 PDT
Created attachment 202144 [details]
Patch
Comment 2 WebKit Commit Bot 2013-05-17 13:24:17 PDT
Attachment 202144 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/Forward.h', u'Source/WebCore/ChangeLog', u'Source/WebCore/WebCore.exp.in', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.cpp', u'Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.h', u'Source/WebKit2/UIProcess/Storage/StorageManager.cpp', u'Source/WebKit2/UIProcess/Storage/StorageManager.h', u'Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp']" exit_code: 1
Source/WebKit2/UIProcess/Storage/StorageManager.h:64:  Missing spaces around >>  [whitespace/operators] [3]
Source/WebKit2/UIProcess/Storage/StorageManager.h:96:  Missing spaces around >>  [whitespace/operators] [3]
Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp:86:  Missing spaces around >>  [whitespace/operators] [3]
Source/WebKit2/UIProcess/Storage/StorageManager.cpp:384:  Missing spaces around >>  [whitespace/operators] [3]
Source/WebKit2/UIProcess/Storage/StorageManager.cpp:569:  Missing spaces around >>  [whitespace/operators] [3]
Source/WebKit2/UIProcess/Storage/StorageManager.cpp:575:  Missing spaces around >>  [whitespace/operators] [3]
Source/WebKit2/UIProcess/Storage/StorageManager.cpp:577:  Missing spaces around >>  [whitespace/operators] [3]
Total errors found: 7 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Andreas Kling 2013-05-17 13:38:02 PDT
Comment on attachment 202144 [details]
Patch

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

r=me with some itches..

> Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.h:56
> +    Vector<RefPtr<WebCore::SecurityOrigin>> origins();

This method should be const.

> Source/WebKit2/UIProcess/Storage/StorageManager.cpp:340
> +    // Make sure the encoding is initialized before we start dispatching things to the queue.
> +    UTF8Encoding();

This looks somewhat arbitrary. Are we sure this is the only encoding that will ever be needed?

> Source/WebKit2/UIProcess/Storage/StorageManager.cpp:571
> +static void callCallbackFunction(void* context, void (*callbackFunction)(const Vector<RefPtr<WebCore::SecurityOrigin>>& securityOrigins, void* context), Vector<RefPtr<WebCore::SecurityOrigin>>* securityOriginsPtr)
> +{
> +    OwnPtr<Vector<RefPtr<WebCore::SecurityOrigin>>> securityOrigins = adoptPtr(securityOriginsPtr);

I wish we could pass securityOriginsPtr as a PassOwnPtr instead here.

> Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp:93
> +    for (size_t i = 0; i < securityOrigins.size(); ++i)

I prefer to use 'unsigned' to iterate over Vectors in new code, as we're planning to move away from size_t there eventually.
Comment 4 Anders Carlsson 2013-05-17 13:41:19 PDT
Committed r150295: <http://trac.webkit.org/changeset/150295>
Comment 5 Alexey Proskuryakov 2013-05-17 21:46:09 PDT
Comment on attachment 202144 [details]
Patch

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

>> Source/WebKit2/UIProcess/Storage/StorageManager.cpp:340
>> +    UTF8Encoding();
> 
> This looks somewhat arbitrary. Are we sure this is the only encoding that will ever be needed?

It's a nice catch. Shouldn't we have ASSERT(isMainThread()) in all those functions? Or better yet, have a dispatch_once?

I agree with Andreas that this looks a bit troubling even if it's 100% correct.