Title: [240156] trunk
Revision
240156
Author
you...@apple.com
Date
2019-01-18 10:19:40 -0800 (Fri, 18 Jan 2019)

Log Message

Add a new SPI to request for cache storage quota increase
https://bugs.webkit.org/show_bug.cgi?id=193323

Reviewed by Alex Christensen.

Source/WebKit:

Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
The current SPI is currently CacheStorage specific but future work should
make it so that other storage like IDB use the same mechanism.
By default, quota remains unchanged if delegate is not implemented.

* NetworkProcess/NetworkProcess.cpp:
* UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
(-[WKWebsiteDataStore _quotaDelegate]):
(-[WKWebsiteDataStore set_quotaDelegate:]):
* UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::requestCacheStorageSpace):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::quotaManager):
(WebKit::WebsiteDataStore::setQuotaManager):
* UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
(WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
(WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
* WebKit.xcodeproj/project.pbxproj:

Tools:

Implement WebsiteDataStore quota delegate to handle quota requests.
By default, do not update quota.
Update quota if test calls the new testRunner.allowCacheStorageQuotaIncrease method.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::allowCacheStorageQuotaIncrease):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::allowCacheStorageQuotaIncrease):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(-[CacheStorageQuotaManager init]):
(-[CacheStorageQuotaManager _requestCacheStorageSpace:frameOrigin:quota:currentSize:spaceRequired:decisionHandler:]):
(WTR::initializeWebViewConfiguration):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::TestController::allowCacheStorageQuotaIncrease):

LayoutTests:

Use new testRunner method to bump the cache quota and verify adding a
cache entry works when bumping the cache quota.

* http/wpt/cache-storage/cache-quota.any.js:
(promise_test):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (240155 => 240156)


--- trunk/LayoutTests/ChangeLog	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/LayoutTests/ChangeLog	2019-01-18 18:19:40 UTC (rev 240156)
@@ -1,5 +1,18 @@
 2019-01-18  Youenn Fablet  <you...@apple.com>
 
+        Add a new SPI to request for cache storage quota increase
+        https://bugs.webkit.org/show_bug.cgi?id=193323
+
+        Reviewed by Alex Christensen.
+
+        Use new testRunner method to bump the cache quota and verify adding a
+        cache entry works when bumping the cache quota.
+
+        * http/wpt/cache-storage/cache-quota.any.js:
+        (promise_test):
+
+2019-01-18  Youenn Fablet  <you...@apple.com>
+
         A track source should be unmuted whenever reenabled after setDirection changes
         https://bugs.webkit.org/show_bug.cgi?id=193554
         <rdar://problem/47366196>

Modified: trunk/LayoutTests/http/wpt/cache-storage/cache-quota.any.js (240155 => 240156)


--- trunk/LayoutTests/http/wpt/cache-storage/cache-quota.any.js	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/LayoutTests/http/wpt/cache-storage/cache-quota.any.js	2019-01-18 18:19:40 UTC (rev 240156)
@@ -114,7 +114,7 @@
         return cache.put("1ko-v2", response1ko.clone()).then(assert_unreached, (e) => {
             assert_equals(e.name, "QuotaExceededError");
         });
-   }).then(() => {
+    }).then(() => {
         return cache.delete("1ko-v1");
     }).then(() => {
         return cache.put("1ko-v2", response1ko.clone());
@@ -151,7 +151,10 @@
         return cache.put("1ko", response1ko.clone()).then(assert_unreached, (e) => {
             assert_equals(e.name, "QuotaExceededError");
         });
-   }).then(() => {
+    }).then(() => {
+        testRunner.allowCacheStorageQuotaIncrease();
+        return cache.put("1ko", response1ko.clone());
+    }).then(() => {
         return cache.delete("1ko-padded-to-200ko");
     }).then(() => {
         return cache.put("1ko-v2", response1ko.clone());

Modified: trunk/Source/WebKit/ChangeLog (240155 => 240156)


--- trunk/Source/WebKit/ChangeLog	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/ChangeLog	2019-01-18 18:19:40 UTC (rev 240156)
@@ -1,3 +1,35 @@
+2019-01-18  Youenn Fablet  <you...@apple.com>
+
+        Add a new SPI to request for cache storage quota increase
+        https://bugs.webkit.org/show_bug.cgi?id=193323
+
+        Reviewed by Alex Christensen.
+
+        Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
+        The current SPI is currently CacheStorage specific but future work should
+        make it so that other storage like IDB use the same mechanism.
+        By default, quota remains unchanged if delegate is not implemented.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        * UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
+        (-[WKWebsiteDataStore _quotaDelegate]):
+        (-[WKWebsiteDataStore set_quotaDelegate:]):
+        * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::WebsiteDataStore):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::quotaManager):
+        (WebKit::WebsiteDataStore::setQuotaManager):
+        * UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
+        (WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
+        (WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2019-01-18  Philippe Normand  <pnorm...@igalia.com>
 
         [WPE] Add Qt extension

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (240155 => 240156)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm	2019-01-18 18:19:40 UTC (rev 240156)
@@ -29,6 +29,7 @@
 #if WK_API_ENABLED
 
 #import "APIString.h"
+#import "CompletionHandlerCallChecker.h"
 #import "WKHTTPCookieStoreInternal.h"
 #import "WKNSArray.h"
 #import "WKWebViewInternal.h"
@@ -38,10 +39,46 @@
 #import "WebResourceLoadStatisticsTelemetry.h"
 #import "WebsiteDataFetchOption.h"
 #import "_WKWebsiteDataStoreConfiguration.h"
+#import "_WKWebsiteDataStoreDelegate.h"
 #import <WebKit/ServiceWorkerProcessProxy.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/URL.h>
+#import <wtf/WeakObjCPtr.h>
 
+class WebsiteDataStoreClient : public WebKit::WebsiteDataStoreClient {
+public:
+    explicit WebsiteDataStoreClient(id <_WKWebsiteDataStoreDelegate> delegate)
+        : m_delegate(delegate)
+        , m_hasRequestCacheStorageSpaceSelector([m_delegate.get() respondsToSelector:@selector(requestCacheStorageSpace: frameOrigin: quota: currentSize: spaceRequired: decisionHandler:)])
+    {
+    }
+
+private:
+    void requestCacheStorageSpace(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& frameOrigin, uint64_t quota, uint64_t currentSize, uint64_t spaceRequired, CompletionHandler<void(Optional<uint64_t>)>&& completionHandler) final
+    {
+        if (!m_hasRequestCacheStorageSpaceSelector || !m_delegate) {
+            completionHandler({ });
+            return;
+        }
+
+        auto checker = WebKit::CompletionHandlerCallChecker::create(m_delegate.getAutoreleased(), @selector(requestCacheStorageSpace: frameOrigin: quota: currentSize: spaceRequired: decisionHandler:));
+        auto decisionHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long quota) mutable {
+            if (checker->completionHandlerHasBeenCalled())
+                return;
+            checker->didCallCompletionHandler();
+            completionHandler(quota);
+        });
+
+        URL mainFrameURL { URL(), topOrigin.toString() };
+        URL frameURL { URL(), frameOrigin.toString() };
+
+        [m_delegate.getAutoreleased() requestCacheStorageSpace:mainFrameURL frameOrigin:frameURL quota:quota currentSize:currentSize spaceRequired:spaceRequired decisionHandler:decisionHandler.get()];
+    }
+
+    WeakObjCPtr<id <_WKWebsiteDataStoreDelegate> > m_delegate;
+    bool m_hasRequestCacheStorageSpaceSelector { false };
+};
+
 @implementation WKWebsiteDataStore
 
 + (WKWebsiteDataStore *)defaultDataStore
@@ -383,6 +420,17 @@
     return WebKit::ServiceWorkerProcessProxy::hasRegisteredServiceWorkers(_websiteDataStore->websiteDataStore().serviceWorkerRegistrationDirectory());
 }
 
+- (id <_WKWebsiteDataStoreDelegate>)_delegate
+{
+    return _delegate.get();
+}
+
+- (void)set_delegate:(id <_WKWebsiteDataStoreDelegate>)delegate
+{
+    _delegate = delegate;
+    _websiteDataStore->websiteDataStore().setClient(makeUniqueRef<WebsiteDataStoreClient>(delegate));
+}
+
 @end
 
 #endif // WK_API_ENABLED

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h (240155 => 240156)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -41,6 +41,7 @@
 @interface WKWebsiteDataStore () <WKObject> {
 @package
     API::ObjectStorage<API::WebsiteDataStore> _websiteDataStore;
+    RetainPtr<id <_WKWebsiteDataStoreDelegate> > _delegate;
 }
 @end
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (240155 => 240156)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -32,6 +32,8 @@
 @class _WKWebsiteDataStoreConfiguration;
 @class WKWebView;
 
+@protocol _WKWebsiteDataStoreDelegate;
+
 typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
     _WKWebsiteDataStoreFetchOptionComputeSizes = 1 << 0,
 } WK_API_AVAILABLE(macosx(10.12), ios(10.0));
@@ -62,6 +64,8 @@
 + (void)_allowWebsiteDataRecordsForAllOrigins WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 - (bool)_hasRegisteredServiceWorker WK_API_AVAILABLE(macosx(10.14), ios(12.0));
 
+@property (nullable, nonatomic, weak) id <_WKWebsiteDataStoreDelegate> _delegate WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 @end
 
 NS_ASSUME_NONNULL_END

Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h (from rev 240155, trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h) (0 => 240156)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@protocol _WKWebsiteDataStoreDelegate <NSObject>
+
+@optional
+
+- (void)requestCacheStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long quota))decisionHandler;
+
+@end
+
+#endif

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (240155 => 240156)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2019-01-18 18:19:40 UTC (rev 240156)
@@ -43,6 +43,8 @@
 #include "WebProcessPool.h"
 #include "WebUserContentControllerProxy.h"
 #include "WebsiteData.h"
+#include "WebsiteDataStoreClient.h"
+#include <WebCore/ClientOrigin.h>
 #include <wtf/CompletionHandler.h>
 
 #if ENABLE(SEC_ITEM_SHIM)
@@ -743,8 +745,7 @@
         return;
     }
 
-    // FIXME: Ask WebsiteDataStore about updating the quota for this origin.
-    completionHandler(quota);
+    store->client().requestCacheStorageSpace(origin.topOrigin, origin.clientOrigin, quota, currentSize, spaceRequired, WTFMove(completionHandler));
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (240155 => 240156)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2019-01-18 18:19:40 UTC (rev 240156)
@@ -40,6 +40,7 @@
 #include "WebResourceLoadStatisticsStore.h"
 #include "WebResourceLoadStatisticsStoreMessages.h"
 #include "WebsiteData.h"
+#include "WebsiteDataStoreClient.h"
 #include "WebsiteDataStoreParameters.h"
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/DatabaseTracker.h>
@@ -97,6 +98,7 @@
 #if ENABLE(WEB_AUTHN)
     , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
 #endif
+    , m_client(makeUniqueRef<WebsiteDataStoreClient>())
 {
     WTF::setProcessPrivileges(allPrivileges());
     maybeRegisterWithSessionIDMap();
@@ -114,6 +116,7 @@
 #if ENABLE(WEB_AUTHN)
     , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
 #endif
+    , m_client(makeUniqueRef<WebsiteDataStoreClient>())
 {
     maybeRegisterWithSessionIDMap();
     platformInitialize();

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (240155 => 240156)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -27,6 +27,7 @@
 
 #include "NetworkSessionCreationParameters.h"
 #include "WebProcessLifetimeObserver.h"
+#include "WebsiteDataStoreClient.h"
 #include "WebsiteDataStoreConfiguration.h"
 #include <WebCore/Cookie.h>
 #include <WebCore/SecurityOriginData.h>
@@ -188,6 +189,9 @@
 
     const WebsiteDataStoreConfiguration& configuration() { return m_configuration.get(); }
 
+    WebsiteDataStoreClient& client() { return m_client.get(); }
+    void setClient(UniqueRef<WebsiteDataStoreClient>&& client) { m_client = WTFMove(client); }
+
 private:
     explicit WebsiteDataStore(PAL::SessionID);
     explicit WebsiteDataStore(Ref<WebsiteDataStoreConfiguration>&&, PAL::SessionID);
@@ -256,6 +260,8 @@
 #if ENABLE(WEB_AUTHN)
     UniqueRef<AuthenticatorManager> m_authenticatorManager;
 #endif
+
+    UniqueRef<WebsiteDataStoreClient> m_client;
 };
 
 }

Copied: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreClient.h (from rev 240155, trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h) (0 => 240156)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreClient.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreClient.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/CompletionHandler.h>
+
+namespace WebCore {
+struct SecurityOriginData;
+}
+
+namespace WebKit {
+
+class WebsiteDataStoreClient {
+public:
+    virtual ~WebsiteDataStoreClient() { }
+
+    virtual void requestCacheStorageSpace(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& frameOrigin, uint64_t quota, uint64_t currentSize, uint64_t spaceRequired, CompletionHandler<void(Optional<uint64_t>)>&& completionHandler)
+    {
+        completionHandler({ });
+    }
+};
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (240155 => 240156)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-01-18 18:19:40 UTC (rev 240156)
@@ -876,6 +876,7 @@
 		41897ED11F415D680016FA42 /* WebCacheStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ECD1F415D5C0016FA42 /* WebCacheStorageConnection.h */; };
 		41897ED81F415D8A0016FA42 /* CacheStorageEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ED21F415D850016FA42 /* CacheStorageEngine.h */; };
 		41897EDA1F415D8A0016FA42 /* CacheStorageEngineConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ED41F415D850016FA42 /* CacheStorageEngineConnection.h */; };
+		41C5379021F15B55008B1FAD /* _WKWebsiteDataStoreDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 41C5378F21F1362D008B1FAD /* _WKWebsiteDataStoreDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41D129DA1F3D101800D15E47 /* WebCacheStorageProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */; };
 		41DC45961E3D6E2200B11F51 /* NetworkRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DC45941E3D6E1E00B11F51 /* NetworkRTCProvider.h */; };
 		41DC459C1E3DBB2800B11F51 /* LibWebRTCSocketClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DC459A1E3DBB2400B11F51 /* LibWebRTCSocketClient.h */; };
@@ -2989,6 +2990,7 @@
 		4112EDD720E4077500BEA92A /* com.apple.NPSafeSubmit.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.NPSafeSubmit.sb; sourceTree = "<group>"; };
 		4112EDD820E4077500BEA92A /* com.apple.NPSafeInput.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.NPSafeInput.sb; sourceTree = "<group>"; };
 		4112EDD920E4077500BEA92A /* com.apple.BocomSubmitCtrl.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.BocomSubmitCtrl.sb; sourceTree = "<group>"; };
+		4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataStoreClient.h; sourceTree = "<group>"; };
 		411A8DD920DDB6050060D34F /* WKMockMediaDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMockMediaDevice.h; sourceTree = "<group>"; };
 		411A8DDA20DDB6050060D34F /* WKMockMediaDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMockMediaDevice.cpp; sourceTree = "<group>"; };
 		411B22621E371244004F7363 /* LibWebRTCNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCNetwork.h; path = Network/webrtc/LibWebRTCNetwork.h; sourceTree = "<group>"; };
@@ -3044,6 +3046,7 @@
 		41B7ED6F206965900087D853 /* NetworkMDNSRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkMDNSRegister.cpp; sourceTree = "<group>"; };
 		41B7ED70206965900087D853 /* NetworkMDNSRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkMDNSRegister.h; sourceTree = "<group>"; };
 		41B7ED71206965900087D853 /* NetworkMDNSRegister.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NetworkMDNSRegister.messages.in; sourceTree = "<group>"; };
+		41C5378F21F1362D008B1FAD /* _WKWebsiteDataStoreDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataStoreDelegate.h; sourceTree = "<group>"; };
 		41C858191F510DEE0065E085 /* CacheStorageEngineCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngineCache.cpp; sourceTree = "<group>"; };
 		41D0FC7D20E43A5100076AE8 /* Network-OSX-sandbox.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Network-OSX-sandbox.entitlements"; sourceTree = "<group>"; };
 		41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCacheStorageProvider.h; sourceTree = "<group>"; };
@@ -4845,7 +4848,7 @@
 				1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */,
 				5C46C0AC21B7198B00BC5991 /* WebsiteDataStoreConfiguration.cpp */,
 				5C46C0AD21B7198C00BC5991 /* WebsiteDataStoreConfiguration.h */,
-				4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreQuotaManager.h */,
+				4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreClient.h */,
 			);
 			path = WebsiteData;
 			sourceTree = "<group>";
@@ -6054,6 +6057,7 @@
 				5120C8331E5B71570025B250 /* _WKWebsiteDataStoreConfiguration.h */,
 				5120C8341E5B71570025B250 /* _WKWebsiteDataStoreConfiguration.mm */,
 				5C46C0AE21B71AE200BC5991 /* _WKWebsiteDataStoreConfigurationInternal.h */,
+				41C5378F21F1362D008B1FAD /* _WKWebsiteDataStoreDelegate.h */,
 				5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */,
 				5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */,
 				5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */,
@@ -8925,6 +8929,7 @@
 				7CB365B11D31DD1E007158CA /* APIUserInitiatedAction.h in Headers */,
 				7C89D2941A67122F003A5FDE /* APIUserScript.h in Headers */,
 				2D8786241BDB58FF00D02ABB /* APIUserStyleSheet.h in Headers */,
+				41C5379021F15B55008B1FAD /* _WKWebsiteDataStoreDelegate.h in Headers */,
 				C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */,
 				C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */,
 				1AE286841C7F93860069AC4F /* APIWebsiteDataRecord.h in Headers */,
@@ -9832,7 +9837,6 @@
 				1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */,
 				513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */,
 				93F549B41E3174B7000E7239 /* WKSnapshotConfiguration.h in Headers */,
-				4118DC1F21E7BF5D00DE04C7 /* WKStorageQuotaDelegatePrivate.h in Headers */,
 				BC407606124FF0270068F20A /* WKString.h in Headers */,
 				BC40761A124FF0370068F20A /* WKStringCF.h in Headers */,
 				BC9099801256A98200083756 /* WKStringPrivate.h in Headers */,

Modified: trunk/Tools/ChangeLog (240155 => 240156)


--- trunk/Tools/ChangeLog	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/ChangeLog	2019-01-18 18:19:40 UTC (rev 240156)
@@ -1,3 +1,30 @@
+2019-01-18  Youenn Fablet  <you...@apple.com>
+
+        Add a new SPI to request for cache storage quota increase
+        https://bugs.webkit.org/show_bug.cgi?id=193323
+
+        Reviewed by Alex Christensen.
+
+        Implement WebsiteDataStore quota delegate to handle quota requests.
+        By default, do not update quota.
+        Update quota if test calls the new testRunner.allowCacheStorageQuotaIncrease method.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::allowCacheStorageQuotaIncrease):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::allowCacheStorageQuotaIncrease):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (-[CacheStorageQuotaManager init]):
+        (-[CacheStorageQuotaManager _requestCacheStorageSpace:frameOrigin:quota:currentSize:spaceRequired:decisionHandler:]):
+        (WTR::initializeWebViewConfiguration):
+        (WTR::TestController::cocoaResetStateToConsistentValues):
+        (WTR::TestController::allowCacheStorageQuotaIncrease):
+
 2019-01-18  Aakash Jain  <aakash_j...@apple.com>
 
         [ews-build] Pass owner to the triggered builds

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-01-18 18:19:40 UTC (rev 240156)
@@ -62,6 +62,7 @@
     void clearDOMCache(DOMString origin);
     boolean hasDOMCache(DOMString origin);
     unsigned long domCacheSize(DOMString origin);
+    void allowCacheStorageQuotaIncrease();
 
     // Special options.
     void keepWebHistory();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2019-01-18 18:19:40 UTC (rev 240156)
@@ -2367,6 +2367,12 @@
     return WKUInt64GetValue(static_cast<WKUInt64Ref>(returnData));
 }
 
+void TestRunner::allowCacheStorageQuotaIncrease()
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("AllowCacheStorageQuotaIncrease"));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
+}
+
 void TestRunner::getApplicationManifestThen(JSValueRef callback)
 {
     cacheTestRunnerCallback(GetApplicationManifestCallbackID, callback);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -175,6 +175,7 @@
     void clearDOMCaches();
     bool hasDOMCache(JSStringRef origin);
     uint64_t domCacheSize(JSStringRef origin);
+    void allowCacheStorageQuotaIncrease();
 
     // IndexedDB
     void setIDBPerOriginQuota(uint64_t);

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2019-01-18 18:19:40 UTC (rev 240156)
@@ -2832,6 +2832,13 @@
     return context.result;
 }
 
+#if !PLATFORM(COCOA)
+void TestController::allowCacheStorageQuotaIncrease()
+{
+    // FIXME: To implement.
+}
+#endif
+
 struct ResourceStatisticsCallbackContext {
     explicit ResourceStatisticsCallbackContext(TestController& controller)
         : testController(controller)

Modified: trunk/Tools/WebKitTestRunner/TestController.h (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/TestController.h	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -248,6 +248,7 @@
     void clearDOMCaches();
     bool hasDOMCache(WKStringRef origin);
     uint64_t domCacheSize(WKStringRef origin);
+    void allowCacheStorageQuotaIncrease();
 
     void setIDBPerOriginQuota(uint64_t);
 

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2019-01-18 18:19:40 UTC (rev 240156)
@@ -1428,6 +1428,11 @@
         return result;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "AllowCacheStorageQuotaIncrease")) {
+        TestController::singleton().allowCacheStorageQuotaIncrease();
+        return nullptr;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "SetIDBPerOriginQuota")) {
         ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
         WKUInt64Ref quota = static_cast<WKUInt64Ref>(messageBody);

Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2019-01-18 18:19:40 UTC (rev 240156)
@@ -84,6 +84,7 @@
 		2E63EDA61891BDC0002A7AFC /* TestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC9981711D3F51E0017BCA2 /* TestRunner.cpp */; };
 		2E749BF21891EBFA007FC175 /* EventSenderProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED7A1891ACE9002A7AFC /* EventSenderProxyIOS.mm */; };
 		31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */; };
+		41C5378E21F13414008B1FAD /* TestWebsiteDataStoreDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41C5378D21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.mm */; };
 		4430AE191F82C4FD0099915A /* GeneratedTouchesDebugWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4430AE171F82C4EE0099915A /* GeneratedTouchesDebugWindow.mm */; };
 		51058AD51D678820009A538C /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */; };
 		51058AD61D678825009A538C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
@@ -286,6 +287,8 @@
 		378D442213346D00006A777B /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
 		41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
 		4181731B138AD39D0057AAA4 /* WebCoreTestSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebCoreTestSupport.h; path = WebCoreTestSupport/WebCoreTestSupport.h; sourceTree = BUILT_PRODUCTS_DIR; };
+		41C5378C21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestWebsiteDataStoreDelegate.h; path = cocoa/TestWebsiteDataStoreDelegate.h; sourceTree = "<group>"; };
+		41C5378D21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestWebsiteDataStoreDelegate.mm; path = cocoa/TestWebsiteDataStoreDelegate.mm; sourceTree = "<group>"; };
 		4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueManager.cpp; sourceTree = "<group>"; };
 		4429FC611627089600F66D8B /* WorkQueueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueueManager.h; sourceTree = "<group>"; };
 		4430AE171F82C4EE0099915A /* GeneratedTouchesDebugWindow.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GeneratedTouchesDebugWindow.mm; sourceTree = "<group>"; };
@@ -564,6 +567,8 @@
 				2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */,
 				0F87B6141BACC4B9004EC572 /* TestRunnerWKWebView.h */,
 				0F87B6151BACC4B9004EC572 /* TestRunnerWKWebView.mm */,
+				41C5378C21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.h */,
+				41C5378D21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.mm */,
 				F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */,
 			);
 			name = cocoa;
@@ -1091,6 +1096,7 @@
 				A185103D1B9AE10600744AEB /* TestInvocationCG.cpp in Sources */,
 				0F622CE91BBB3A1A00838AD3 /* TestOptions.cpp in Sources */,
 				0F87B6171BACC4C0004EC572 /* TestRunnerWKWebView.mm in Sources */,
+				41C5378E21F13414008B1FAD /* TestWebsiteDataStoreDelegate.mm in Sources */,
 				0F18E6E51D6B9B9E0027E547 /* UIScriptContext.cpp in Sources */,
 				0F18E6E61D6B9BA20027E547 /* UIScriptController.cpp in Sources */,
 				F46240B1217013E500917B16 /* UIScriptControllerCocoa.mm in Sources */,

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (240155 => 240156)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2019-01-18 18:16:16 UTC (rev 240155)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2019-01-18 18:19:40 UTC (rev 240156)
@@ -31,6 +31,7 @@
 #import "StringFunctions.h"
 #import "TestInvocation.h"
 #import "TestRunnerWKWebView.h"
+#import "TestWebsiteDataStoreDelegate.h"
 #import <Foundation/Foundation.h>
 #import <Security/SecItem.h>
 #import <WebKit/WKContextConfigurationRef.h>
@@ -55,6 +56,10 @@
 
 static WKWebViewConfiguration *globalWebViewConfiguration;
 
+#if WK_API_ENABLED
+static TestWebsiteDataStoreDelegate *globalWebsiteDataStoreDelegateClient;
+#endif
+
 void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injectedBundlePath, WKContextRef context, WKContextConfigurationRef contextConfiguration)
 {
 #if WK_API_ENABLED
@@ -80,6 +85,12 @@
     [globalWebViewConfiguration.websiteDataStore _setResourceLoadStatisticsEnabled:YES];
     [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:NO];
 
+#if WK_API_ENABLED
+    [globalWebsiteDataStoreDelegateClient release];
+    globalWebsiteDataStoreDelegateClient = [[TestWebsiteDataStoreDelegate alloc] init];
+    [globalWebViewConfiguration.websiteDataStore set_delegate:globalWebsiteDataStoreDelegateClient];
+#endif
+
 #if PLATFORM(IOS_FAMILY)
     globalWebViewConfiguration.allowsInlineMediaPlayback = YES;
     globalWebViewConfiguration._inlineMediaPlaybackRequiresPlaysInlineAttribute = NO;
@@ -252,6 +263,8 @@
         if (options.shouldShowSpellCheckingDots)
             [platformView toggleContinuousSpellChecking:nil];
     }
+
+    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: false];
 #endif
 }
 
@@ -385,4 +398,11 @@
     return false;
 }
 
+void TestController::allowCacheStorageQuotaIncrease()
+{
+#if WK_API_ENABLED
+    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: true];
+#endif
+}
+
 } // namespace WTR

Copied: trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h (from rev 240155, trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h) (0 => 240156)


--- trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h	2019-01-18 18:19:40 UTC (rev 240156)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebKit/_WKWebsiteDataStoreDelegate.h>
+
+#if WK_API_ENABLED
+
+@interface TestWebsiteDataStoreDelegate: NSObject <_WKWebsiteDataStoreDelegate> {
+@private
+    BOOL _shouldAllowRaisingQuota;
+}
+- (instancetype)init;
+- (void)setAllowRaisingQuota:(BOOL)shouldAllowRaisingQuota;
+@end
+
+#endif

Copied: trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm (from rev 240155, trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h) (0 => 240156)


--- trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm	2019-01-18 18:19:40 UTC (rev 240156)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "TestWebsiteDataStoreDelegate.h"
+
+#if WK_API_ENABLED
+
+@implementation TestWebsiteDataStoreDelegate { }
+- (instancetype)init
+{
+    _shouldAllowRaisingQuota = false;
+    return self;
+}
+
+- (void)requestCacheStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long quota))decisionHandler
+{
+    decisionHandler(_shouldAllowRaisingQuota ? 2 * quota : quota);
+}
+
+- (void)setAllowRaisingQuota:(BOOL)shouldAllowRaisingQuota
+{
+    _shouldAllowRaisingQuota = shouldAllowRaisingQuota;
+}
+@end
+
+#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to