RESOLVED FIXED 169044
Add SPI to create WebsiteDataStore objects pointing to custom paths
https://bugs.webkit.org/show_bug.cgi?id=169044
Summary Add SPI to create WebsiteDataStore objects pointing to custom paths
Brady Eidson
Reported 2017-03-01 10:38:26 PST
Add SPI to create WebsiteDataStore objects pointing to custom paths This is not comprehensive quite yet; Baby steps.
Attachments
Patch (21.96 KB, text/plain)
2017-03-01 10:39 PST, Brady Eidson
no flags
Patch (15.29 KB, patch)
2017-03-01 10:41 PST, Brady Eidson
no flags
Patch (28.19 KB, patch)
2017-03-01 12:48 PST, Brady Eidson
no flags
Brady Eidson
Comment 1 2017-03-01 10:39:47 PST
Brady Eidson
Comment 2 2017-03-01 10:41:49 PST
Tim Horton
Comment 3 2017-03-01 10:46:05 PST
Comment on attachment 303080 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=303080&action=review > Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h:42 > + WebsiteDataStore(WebKit::WebsiteDataStore::Configuration); +explicit > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:34 > +WK_CLASS_AVAILABLE(macosx(10.12), ios(10.0)) This does not seem accurate. > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:37 > +@property (nonatomic, strong) NSString *webStorageDirectory; Don't we usually copy string properties? I guess it doesn't really matter because you toss the configuration immediately after it's passed in, but it's good practice.
Brady Eidson
Comment 4 2017-03-01 12:48:01 PST
WebKit Commit Bot
Comment 5 2017-03-01 12:50:51 PST
Attachment 303099 [details] did not pass style-queue: ERROR: Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm:31: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 6 2017-03-01 14:03:07 PST
Comment on attachment 303099 [details] Patch Clearing flags on attachment: 303099 Committed r213241: <http://trac.webkit.org/changeset/213241>
WebKit Commit Bot
Comment 7 2017-03-01 14:03:10 PST
All reviewed patches have been landed. Closing bug.
mitz
Comment 8 2017-03-01 14:24:10 PST
Comment on attachment 303099 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=303099&action=review > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:39 > +@property (nonatomic, copy) NSString *webStorageDirectory; > +@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory; > +@property (nonatomic, copy) NSString *webSQLDatabaseDirectory; Modern Cocoa APIs use file NSURLs for filesystem locations rather than path NSStrings.
Brady Eidson
Comment 9 2017-03-01 15:20:24 PST
(In reply to comment #8) > Comment on attachment 303099 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=303099&action=review > > > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:39 > > +@property (nonatomic, copy) NSString *webStorageDirectory; > > +@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory; > > +@property (nonatomic, copy) NSString *webSQLDatabaseDirectory; > > Modern Cocoa APIs use file NSURLs for filesystem locations rather than path > NSStrings. What would you suggest the failure mode be if somebody puts in a remote URL?
Tim Horton
Comment 10 2017-03-01 15:44:10 PST
(In reply to comment #9) > (In reply to comment #8) > > Comment on attachment 303099 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=303099&action=review > > > > > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:39 > > > +@property (nonatomic, copy) NSString *webStorageDirectory; > > > +@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory; > > > +@property (nonatomic, copy) NSString *webSQLDatabaseDirectory; > > > > Modern Cocoa APIs use file NSURLs for filesystem locations rather than path > > NSStrings. > > What would you suggest the failure mode be if somebody puts in a remote URL? What is the failure mode if somebody puts in a garbage string? They should probably be the same.
Brady Eidson
Comment 11 2017-03-01 15:49:37 PST
(In reply to comment #10) > (In reply to comment #9) > > (In reply to comment #8) > > > Comment on attachment 303099 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=303099&action=review > > > > > > > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:39 > > > > +@property (nonatomic, copy) NSString *webStorageDirectory; > > > > +@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory; > > > > +@property (nonatomic, copy) NSString *webSQLDatabaseDirectory; > > > > > > Modern Cocoa APIs use file NSURLs for filesystem locations rather than path > > > NSStrings. > > > > What would you suggest the failure mode be if somebody puts in a remote URL? > > What is the failure mode if somebody puts in a garbage string? They should > probably be the same. Currently a garbage string would result in "things just don't work right", simply because we have no special handling. Transitioning to NSURLs - without specifically addressing the failure mode - could mean that storage/websql/indexeddb reads might actually try to go to the network.
Brady Eidson
Comment 12 2017-03-01 15:50:00 PST
I'm definitely willing to iterate on this once we identify the appropriate failure mode.
Tim Horton
Comment 13 2017-03-01 15:53:38 PST
It's a programming error, not a "we don't expect this to happen" error, so why not throw an exception?
Brady Eidson
Comment 14 2017-03-01 16:05:32 PST
(In reply to comment #13) > It's a programming error, not a "we don't expect this to happen" error, so > why not throw an exception? If that's the desired behavior, I can implement it.
mitz
Comment 15 2017-03-01 18:26:01 PST
(In reply to comment #9) > (In reply to comment #8) > > Comment on attachment 303099 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=303099&action=review > > > > > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:39 > > > +@property (nonatomic, copy) NSString *webStorageDirectory; > > > +@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory; > > > +@property (nonatomic, copy) NSString *webSQLDatabaseDirectory; > > > > Modern Cocoa APIs use file NSURLs for filesystem locations rather than path > > NSStrings. > > What would you suggest the failure mode be if somebody puts in a remote URL? Same thing we do in -[WKWebView loadFileURL:allowingReadAccessToURL:].
Brady Eidson
Comment 16 2017-03-01 20:38:29 PST
(In reply to comment #15) > (In reply to comment #9) > > (In reply to comment #8) > > > Comment on attachment 303099 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=303099&action=review > > > > > > > Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:39 > > > > +@property (nonatomic, copy) NSString *webStorageDirectory; > > > > +@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory; > > > > +@property (nonatomic, copy) NSString *webSQLDatabaseDirectory; > > > > > > Modern Cocoa APIs use file NSURLs for filesystem locations rather than path > > > NSStrings. > > > > What would you suggest the failure mode be if somebody puts in a remote URL? > > Same thing we do in -[WKWebView loadFileURL:allowingReadAccessToURL:]. A concrete example! I like those. :) Thanks!
Note You need to log in before you can comment on or make changes to this bug.