Title: [215897] trunk
Revision
215897
Author
[email protected]
Date
2017-04-27 15:37:29 -0700 (Thu, 27 Apr 2017)

Log Message

Add stub SPI for setting cookie storage path on _WKWebsiteDataStoreConfiguration
https://bugs.webkit.org/show_bug.cgi?id=171399

Reviewed by Brady Eidson.

Source/WebKit2:

This SPI isn't hooked up yet, but it has a test that will need to be updated once it works.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _initWithConfiguration:]):
* UIProcess/API/Cocoa/_WKDraggableElementInfo.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration _cookieStorageDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setCookieStorageDirectory:]):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resolvedCookieStorageDirectory):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (215896 => 215897)


--- trunk/Source/WebKit2/ChangeLog	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-27 22:37:29 UTC (rev 215897)
@@ -1,3 +1,23 @@
+2017-04-27  Alex Christensen  <[email protected]>
+
+        Add stub SPI for setting cookie storage path on _WKWebsiteDataStoreConfiguration
+        https://bugs.webkit.org/show_bug.cgi?id=171399
+
+        Reviewed by Brady Eidson.
+
+        This SPI isn't hooked up yet, but it has a test that will need to be updated once it works.
+
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _initWithConfiguration:]):
+        * UIProcess/API/Cocoa/_WKDraggableElementInfo.h:
+        * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
+        * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
+        (-[_WKWebsiteDataStoreConfiguration _cookieStorageDirectory]):
+        (-[_WKWebsiteDataStoreConfiguration _setCookieStorageDirectory:]):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::resolvedCookieStorageDirectory):
+
 2017-04-27  Chris Dumez  <[email protected]>
 
         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (215896 => 215897)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2017-04-27 22:37:29 UTC (rev 215897)
@@ -246,7 +246,7 @@
 #endif
 
 - (WKNavigation *)_reloadWithoutContentBlockers WK_API_AVAILABLE(macosx(10.12), ios(10.0));
-- (WKNavigation *)_reloadExpiredOnly WK_API_AVAILABLE(macosx(10.13), ios(11.0));
+- (WKNavigation *)_reloadExpiredOnly WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 - (void)_killWebContentProcessAndResetState;
 
@@ -288,7 +288,7 @@
 
 @property (nonatomic, readonly) BOOL _webProcessIsResponsive WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 
-@property (nonatomic, setter=_setFullscreenDelegate:) id<_WKFullscreenDelegate> _fullscreenDelegate WK_API_AVAILABLE(macosx(10.13));
+@property (nonatomic, setter=_setFullscreenDelegate:) id<_WKFullscreenDelegate> _fullscreenDelegate WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 @property (nonatomic, readonly) BOOL _isInFullscreen WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 
 - (void)_muteMediaCapture;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (215896 => 215897)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm	2017-04-27 22:37:29 UTC (rev 215897)
@@ -160,6 +160,8 @@
         config.webSQLDatabaseDirectory = configuration._webSQLDatabaseDirectory.path;
     if (configuration._indexedDBDatabaseDirectory)
         config.indexedDBDatabaseDirectory = configuration._indexedDBDatabaseDirectory.path;
+    if (configuration._cookieStorageDirectory)
+        config.cookieStorageDirectory = configuration._cookieStorageDirectory.path;
 
     API::Object::constructInWrapper<API::WebsiteDataStore>(self, config);
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDraggableElementInfo.h (215896 => 215897)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDraggableElementInfo.h	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDraggableElementInfo.h	2017-04-27 22:37:29 UTC (rev 215897)
@@ -29,7 +29,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-WK_CLASS_AVAILABLE(macosx(10.13), ios(11.0))
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
 @interface _WKDraggableElementInfo : NSObject <NSCopying>
 
 @property (nonatomic, readonly) CGPoint point;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h (215896 => 215897)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h	2017-04-27 22:37:29 UTC (rev 215897)
@@ -31,12 +31,13 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-WK_CLASS_AVAILABLE(macosx(10.13), ios(11.0))
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
 @interface _WKWebsiteDataStoreConfiguration : NSObject
 
 @property (nonatomic, copy, setter=_setWebStorageDirectory:) NSURL *_webStorageDirectory;
 @property (nonatomic, copy, setter=_setIndexedDBDatabaseDirectory:) NSURL *_indexedDBDatabaseDirectory;
 @property (nonatomic, copy, setter=_setWebSQLDatabaseDirectory:) NSURL *_webSQLDatabaseDirectory;
+@property (nonatomic, copy, setter=_setCookieStorageDirectory:) NSURL *_cookieStorageDirectory WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm (215896 => 215897)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm	2017-04-27 22:37:29 UTC (rev 215897)
@@ -40,6 +40,7 @@
     RetainPtr<NSURL> _webStorageDirectoryURL;
     RetainPtr<NSURL> _indexedDBDatabaseDirectoryURL;
     RetainPtr<NSURL> _webSQLDatabaseDirectoryURL;
+    RetainPtr<NSURL> _cookieStorageDirectoryURL;
 }
 
 -(NSURL *)_webStorageDirectory {
@@ -68,6 +69,16 @@
     checkURLArgument(url);
     _webSQLDatabaseDirectoryURL = adoptNS([url copy]);
 }
+
+-(NSURL *)_cookieStorageDirectory {
+    return _cookieStorageDirectoryURL.get();
+}
+
+-(void)_setCookieStorageDirectory:(NSURL *)url {
+    checkURLArgument(url);
+    _cookieStorageDirectoryURL = adoptNS([url copy]);
+}
+
 @end
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (215896 => 215897)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2017-04-27 22:37:29 UTC (rev 215897)
@@ -69,6 +69,7 @@
         String mediaKeysStorageDirectory;
         String resourceLoadStatisticsDirectory;
         String _javascript_ConfigurationDirectory;
+        String cookieStorageDirectory;
     };
     static Ref<WebsiteDataStore> createNonPersistent();
     static Ref<WebsiteDataStore> create(Configuration);
@@ -100,6 +101,7 @@
     const String& resolvedMediaKeysDirectory() const { return m_resolvedConfiguration.mediaKeysStorageDirectory; }
     const String& resolvedDatabaseDirectory() const { return m_resolvedConfiguration.webSQLDatabaseDirectory; }
     const String& resolvedJavaScriptConfigurationDirectory() const { return m_resolvedConfiguration._javascript_ConfigurationDirectory; }
+    const String& resolvedCookieStorageDirectory() const { return m_resolvedConfiguration.cookieStorageDirectory; }
 
     StorageManager* storageManager() { return m_storageManager.get(); }
 

Modified: trunk/Tools/ChangeLog (215896 => 215897)


--- trunk/Tools/ChangeLog	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Tools/ChangeLog	2017-04-27 22:37:29 UTC (rev 215897)
@@ -1,3 +1,14 @@
+2017-04-27  Alex Christensen  <[email protected]>
+
+        Add stub SPI for setting cookie storage path on _WKWebsiteDataStoreConfiguration
+        https://bugs.webkit.org/show_bug.cgi?id=171399
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.html:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm:
+        (TEST):
+
 2017-04-27  Ryan Haddad  <[email protected]>
 
         Disable flaky API test WKWebView.SetOverrideContentSecurityPolicyWithEmptyStringForPageWithCSP.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.html (215896 => 215897)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.html	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.html	2017-04-27 22:37:29 UTC (rev 215897)
@@ -1,6 +1,6 @@
 <script>
 
-// This test opens an IndexedDB, a WebSQL db, and makes a localStorage write.
+// This test opens an IndexedDB, a WebSQL db, and a cookie storage, and makes a localStorage write.
 
 function log(msg)
 {
@@ -23,6 +23,9 @@
     log('Unexpected error opening indexed database');
 }
 
+document.cookie = "testkey=value; expires=Mon, 01 Jan 2035 00:00:00 GMT";
+log('cookie written');
+
 try {
 openDatabase('WebsiteDataStoreCustomPathsSQL', '1.0', 'Test DB', 524288, function() {
     log('WebSQL database created');

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm (215896 => 215897)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm	2017-04-27 22:37:14 UTC (rev 215896)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm	2017-04-27 22:37:29 UTC (rev 215897)
@@ -77,19 +77,23 @@
     NSURL *sqlPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/WebSQL/" stringByExpandingTildeInPath]];
     NSURL *idbPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/" stringByExpandingTildeInPath]];
     NSURL *localStoragePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/LocalStorage/" stringByExpandingTildeInPath]];
+    NSURL *cookieStoragePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/CookieStorage/" stringByExpandingTildeInPath]];
 
     [[NSFileManager defaultManager] removeItemAtURL:sqlPath error:nil];
     [[NSFileManager defaultManager] removeItemAtURL:idbPath error:nil];
     [[NSFileManager defaultManager] removeItemAtURL:localStoragePath error:nil];
+    [[NSFileManager defaultManager] removeItemAtURL:cookieStoragePath error:nil];
 
     EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:sqlPath.path]);
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:idbPath.path]);
     EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath.path]);
-    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:idbPath.path]);
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:cookieStoragePath.path]);
 
     _WKWebsiteDataStoreConfiguration *websiteDataStoreConfiguration = [[_WKWebsiteDataStoreConfiguration alloc] init];
     websiteDataStoreConfiguration._webSQLDatabaseDirectory = sqlPath;
     websiteDataStoreConfiguration._indexedDBDatabaseDirectory = idbPath;
     websiteDataStoreConfiguration._webStorageDirectory = localStoragePath;
+    websiteDataStoreConfiguration._cookieStorageDirectory = cookieStoragePath;
 
     configuration.get().websiteDataStore = [[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration];
     [websiteDataStoreConfiguration release];
@@ -99,14 +103,18 @@
     NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"WebsiteDataStoreCustomPaths" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
     [webView loadRequest:request];
 
-    // We expect 3 messages, 1 each for WebSQL, IndexedDB, and localStorage.
-    getNextMessage();
-    getNextMessage();
-    getNextMessage();
+    // We expect 4 messages, 1 each for WebSQL, IndexedDB, cookies, and localStorage.
+    EXPECT_STREQ([getNextMessage().body UTF8String], "localstorage written");
+    EXPECT_STREQ([getNextMessage().body UTF8String], "cookie written");
+    EXPECT_STREQ([getNextMessage().body UTF8String], "Exception: QuotaExceededError (DOM Exception 22): The quota has been exceeded.");
+    EXPECT_STREQ([getNextMessage().body UTF8String], "Success opening indexed database");
 
     EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:sqlPath.path]);
     EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath.path]);
-
+    
+    // FIXME: Once this API works this should be true, and there should be a file that contains the bytes "testkey=value"
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:cookieStoragePath.path]);
+    
     // FIXME: <rdar://problem/30785618> - We don't yet support IDB database processes at custom paths per WebsiteDataStore
     // EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:idbPath]);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to