Bug 236727 - Ensure NetworkStorageManager::moveData performs move operation based on data types
Summary: Ensure NetworkStorageManager::moveData performs move operation based on data ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Website Storage (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-16 12:10 PST by Sihui Liu
Modified: 2022-02-17 10:20 PST (History)
5 users (show)

See Also:


Attachments
Patch (15.52 KB, patch)
2022-02-16 12:27 PST, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (15.52 KB, patch)
2022-02-16 16:34 PST, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2022-02-16 12:10:35 PST
...
Comment 1 Sihui Liu 2022-02-16 12:11:10 PST
rdar://89009881
Comment 2 Sihui Liu 2022-02-16 12:27:53 PST
Created attachment 452229 [details]
Patch
Comment 3 Chris Dumez 2022-02-16 16:16:27 PST
Comment on attachment 452229 [details]
Patch

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

r=me

> Source/WebKit/ChangeLog:3
> +        Ensure NetworkStorageManager::moveData perform move operation based on data types

perform -> performs

> Source/WebKit/ChangeLog:9
> +        In r286936, we introduced NetworkStorageManager::moveData to move data from one origin from another origin.

"from one origin from another origin" doesn't really make sense. Maybe you mean "from one origin to another".

> Source/WebKit/ChangeLog:11
> +        NetworkStorageManager would try to move every storage type it manages. This has caused unexpected failure, as

"failures" or "an unexpected failure"

> Source/WebKit/ChangeLog:16
> +        Updated existing API test to ensure only expected type of data is moved.

"type of data is moved" -> "data types are moved"

> Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:221
> +    void moveData(OptionSet<WebsiteDataType> types, const String& localStoragePath, const String& idbStoragePath)

Would be nice to move the implementation out of the class to improve readability. This is too huge to be inline IMO.

> Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:223
> +        // This is only supported for IndexedDB and LocalStorage now.

Do we need to add an assertion to make sure we only get types we can handle?

> Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:247
> +    String resolvedLocalStoragePath()

Would be nice to move the implementation out of the class to improve readability. This is too huge to be inline IMO.
Comment 4 Sihui Liu 2022-02-16 16:32:37 PST
Comment on attachment 452229 [details]
Patch

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

>> Source/WebKit/ChangeLog:3
>> +        Ensure NetworkStorageManager::moveData perform move operation based on data types
> 
> perform -> performs

Updated.

>> Source/WebKit/ChangeLog:9
>> +        In r286936, we introduced NetworkStorageManager::moveData to move data from one origin from another origin.
> 
> "from one origin from another origin" doesn't really make sense. Maybe you mean "from one origin to another".

Yes it should be "to".

>> Source/WebKit/ChangeLog:16
>> +        Updated existing API test to ensure only expected type of data is moved.
> 
> "type of data is moved" -> "data types are moved"

Okay.

>> Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:221
>> +    void moveData(OptionSet<WebsiteDataType> types, const String& localStoragePath, const String& idbStoragePath)
> 
> Would be nice to move the implementation out of the class to improve readability. This is too huge to be inline IMO.

We may move all the StorageBucket functions outside of the class altogether. I will do it in a followup.

>> Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:223
>> +        // This is only supported for IndexedDB and LocalStorage now.
> 
> Do we need to add an assertion to make sure we only get types we can handle?

There's an assertion in:
- (void)_renameOrigin:(NSURL *)oldName to:(NSURL *)newName forDataOfTypes:(NSSet<NSString *> *)dataTypes completionHandler:(void (^)(void))completionHandler
Comment 5 Sihui Liu 2022-02-16 16:34:54 PST
Created attachment 452271 [details]
Patch
Comment 6 EWS 2022-02-17 10:20:44 PST
Committed r290033 (247413@main): <https://commits.webkit.org/247413@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 452271 [details].