WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
214905
-[WKWebsiteDataStore _renameOrigin:] needs to support IndexedDB renames
https://bugs.webkit.org/show_bug.cgi?id=214905
Summary
-[WKWebsiteDataStore _renameOrigin:] needs to support IndexedDB renames
Timothy Hatcher
Reported
2020-07-28 18:11:28 PDT
For Web Extensions in Safari, we need to rename origins between launches. Right now we are using the -[WKWebsiteDataStore _renameOrigin:] SPI, but it only supports LocalStorage. We need to support IndexedDB as well. See NetworkProcess::renameOriginInWebsiteData() for where the additional WebsiteDataType::IndexedDBDatabases type support needs added.
Attachments
Patch
(16.36 KB, patch)
2020-07-30 14:06 PDT
,
Sihui Liu
no flags
Details
Formatted Diff
Diff
Patch
(15.60 KB, patch)
2020-07-30 14:07 PDT
,
Sihui Liu
no flags
Details
Formatted Diff
Diff
Patch
(15.40 KB, patch)
2020-07-30 14:44 PDT
,
Sihui Liu
no flags
Details
Formatted Diff
Diff
Patch for landing
(15.16 KB, patch)
2020-07-31 10:07 PDT
,
Sihui Liu
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-07-28 18:11:40 PDT
Comment hidden (obsolete)
<
rdar://problem/66247978
>
Radar WebKit Bug Importer
Comment 2
2020-07-28 18:12:19 PDT
Comment hidden (obsolete)
<
rdar://problem/66248009
>
Timothy Hatcher
Comment 3
2020-07-28 18:12:32 PDT
Comment hidden (obsolete)
<
rdar://problem/66247978
>
Timothy Hatcher
Comment 4
2020-07-28 18:19:26 PDT
<
rdar://problem/64790993
>
Sihui Liu
Comment 5
2020-07-30 14:06:09 PDT
Created
attachment 405614
[details]
Patch
Sihui Liu
Comment 6
2020-07-30 14:07:00 PDT
Created
attachment 405615
[details]
Patch
Timothy Hatcher
Comment 7
2020-07-30 14:30:04 PDT
Comment on
attachment 405615
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=405615&action=review
> Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:616 > + auto filteredTypes = [dataTypes objectsPassingTest:^BOOL(id obj, BOOL *stop) { > + NSString *type = (NSString *)obj; > + NSSet *supportedTypes = [NSSet setWithObjects:WKWebsiteDataTypeLocalStorage, WKWebsiteDataTypeIndexedDBDatabases, nil]; > + return ![supportedTypes containsObject:type]; > + }]; > + if (filteredTypes.count) {
A better way to do this would be: NSSet *supportedTypes = [NSSet setWithObjects:WKWebsiteDataTypeLocalStorage, WKWebsiteDataTypeIndexedDBDatabases, nil]; if (![dataTypes isSubsetOfSet:supportedTypes]) [NSException raise:...]; Calling the completion handler after the exception is not needed. The exception ended execution of the method.
Sihui Liu
Comment 8
2020-07-30 14:43:37 PDT
Comment on
attachment 405615
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=405615&action=review
>> Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:616 >> + if (filteredTypes.count) { > > A better way to do this would be: > > NSSet *supportedTypes = [NSSet setWithObjects:WKWebsiteDataTypeLocalStorage, WKWebsiteDataTypeIndexedDBDatabases, nil]; > if (![dataTypes isSubsetOfSet:supportedTypes]) > [NSException raise:...]; > > Calling the completion handler after the exception is not needed. The exception ended execution of the method.
Will update!
Sihui Liu
Comment 9
2020-07-30 14:44:33 PDT
Created
attachment 405623
[details]
Patch
Alex Christensen
Comment 10
2020-07-30 16:11:17 PDT
Comment on
attachment 405623
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=405623&action=review
> Source/WebCore/Modules/indexeddb/server/IDBServer.cpp:721 > + renameOriginForVersion("v0");
Why would we want to rename v0? The SPI user of this will only have v1, I think.
> Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.cpp:101 > + postTaskReply(CrossThreadTask([callback = WTFMove(callback)]() mutable {
Could this be simpler instead of making a lambda just to wrap a CompletionHandler? postTaskReply(CrossThreadTask(WTFMove(callback)));
> Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:561 > + RetainPtr<WebsiteDataStoreCustomPathsMessageHandler> handler = adoptNS([[WebsiteDataStoreCustomPathsMessageHandler alloc] init]);
These could use auto.
Sihui Liu
Comment 11
2020-07-30 21:55:50 PDT
(In reply to Alex Christensen from
comment #10
)
> Comment on
attachment 405623
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=405623&action=review
> > > Source/WebCore/Modules/indexeddb/server/IDBServer.cpp:721 > > + renameOriginForVersion("v0"); > > Why would we want to rename v0? The SPI user of this will only have v1, I > think. >
I have no idea about that so I rename both. Will update.
> > Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.cpp:101 > > + postTaskReply(CrossThreadTask([callback = WTFMove(callback)]() mutable { > > Could this be simpler instead of making a lambda just to wrap a > CompletionHandler? > postTaskReply(CrossThreadTask(WTFMove(callback))); >
Yes.
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:561 > > + RetainPtr<WebsiteDataStoreCustomPathsMessageHandler> handler = adoptNS([[WebsiteDataStoreCustomPathsMessageHandler alloc] init]); > > These could use auto.
Okay.
Sihui Liu
Comment 12
2020-07-31 10:07:07 PDT
Created
attachment 405702
[details]
Patch for landing
EWS
Comment 13
2020-07-31 10:44:24 PDT
Committed
r265149
: <
https://trac.webkit.org/changeset/265149
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 405702
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug