Add SPI to create WebsiteDataStore objects pointing to custom paths This is not comprehensive quite yet; Baby steps.
Created attachment 303079 [details] Patch
Created attachment 303080 [details] Patch
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.
Created attachment 303099 [details] Patch
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.
Comment on attachment 303099 [details] Patch Clearing flags on attachment: 303099 Committed r213241: <http://trac.webkit.org/changeset/213241>
All reviewed patches have been landed. Closing bug.
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.
(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?
(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.
(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.
I'm definitely willing to iterate on this once we identify the appropriate failure mode.
It's a programming error, not a "we don't expect this to happen" error, so why not throw an exception?
(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.
(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:].
(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!