WebKit Bugzilla
Attachment 359394 Details for
Bug 193323
: Add a new SPI to request for cache storage quota increase
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193323-20190117111720.patch (text/plain), 29.96 KB, created by
youenn fablet
on 2019-01-17 11:17:21 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-17 11:17:21 PST
Size:
29.96 KB
patch
obsolete
>Subversion Revision: 240112 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index e492f8af27f8e1849826495a30f68393b87ff200..364490b504cecd5b4faf37519d5fe303c7e2c9bd 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,35 @@ >+2019-01-17 Youenn Fablet <youenn@apple.com> >+ >+ Add a new SPI to request for cache storage quota increase >+ https://bugs.webkit.org/show_bug.cgi?id=193323 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-16 Youenn Fablet <youenn@apple.com> > > Add a new SPI for controlling getUserMedia >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h >new file mode 100644 >index 0000000000000000000000000000000000000000..92e1f0cf42fa7866f48da7d7810271641f21ac47 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h >@@ -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. >+ */ >+ >+#import <WebKit/WKFoundation.h> >+ >+#if WK_API_ENABLED >+ >+#import <Foundation/Foundation.h> >+ >+@protocol WKStorageQuotaDelegatePrivate <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 >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >index 2d160ea3b1288fe84dc1d8293c0a328381feb26a..dc0a7199bb4ac07a198f17fa53885bd89eb9bf3c 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >@@ -29,8 +29,10 @@ > #if WK_API_ENABLED > > #import "APIString.h" >+#import "CompletionHandlerCallChecker.h" > #import "WKHTTPCookieStoreInternal.h" > #import "WKNSArray.h" >+#import "WKStorageQuotaDelegatePrivate.h" > #import "WKWebViewInternal.h" > #import "WKWebsiteDataRecordInternal.h" > #import "WebPageProxy.h" >@@ -42,6 +44,40 @@ > #import <wtf/BlockPtr.h> > #import <wtf/URL.h> > >+class WebsiteDataStoreQuotaManager : public WebKit::WebsiteDataStoreQuotaManager { >+public: >+ explicit WebsiteDataStoreQuotaManager(id <WKStorageQuotaDelegatePrivate> delegate) >+ : m_quotaDelegate(delegate) >+ , m_hasRequestCacheStorageSpaceSelector([m_quotaDelegate.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) { >+ completionHandler({ }); >+ return; >+ } >+ >+ auto checker = WebKit::CompletionHandlerCallChecker::create(m_quotaDelegate.get(), @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_quotaDelegate.get() _requestCacheStorageSpace:mainFrameURL frameOrigin:frameURL quota:quota currentSize:currentSize spaceRequired:spaceRequired decisionHandler:decisionHandler.get()]; >+ } >+ >+ RetainPtr<id <WKStorageQuotaDelegatePrivate> > m_quotaDelegate; >+ bool m_hasRequestCacheStorageSpaceSelector { false }; >+}; >+ > @implementation WKWebsiteDataStore > > + (WKWebsiteDataStore *)defaultDataStore >@@ -383,6 +419,17 @@ - (bool)_hasRegisteredServiceWorker > return WebKit::ServiceWorkerProcessProxy::hasRegisteredServiceWorkers(_websiteDataStore->websiteDataStore().serviceWorkerRegistrationDirectory()); > } > >+- (id <WKStorageQuotaDelegatePrivate>)_quotaDelegate >+{ >+ return _quotaDelegate.get(); >+} >+ >+- (void)set_quotaDelegate:(id <WKStorageQuotaDelegatePrivate>)quotaDelegate >+{ >+ _quotaDelegate = quotaDelegate; >+ _websiteDataStore->websiteDataStore().setQuotaManager(makeUniqueRef<WebsiteDataStoreQuotaManager>(quotaDelegate)); >+} >+ > @end > > #endif // WK_API_ENABLED >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h >index d861875273ba7df67e2866d1455b96b7f3dc47f6..e31f3b67fb3890b92e3cb92a506a1ee92118443e 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h >@@ -41,6 +41,7 @@ template<> struct WrapperTraits<API::WebsiteDataStore> { > @interface WKWebsiteDataStore () <WKObject> { > @package > API::ObjectStorage<API::WebsiteDataStore> _websiteDataStore; >+ RetainPtr<id <WKStorageQuotaDelegatePrivate> > _quotaDelegate; > } > @end > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h >index 74a8a02f2f1d9ee95c97af9a96e3c60131920161..ad04ce88a9b445a2048178bd951e7da0a2a61663 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h >@@ -32,6 +32,8 @@ NS_ASSUME_NONNULL_BEGIN > @class _WKWebsiteDataStoreConfiguration; > @class WKWebView; > >+@protocol WKStorageQuotaDelegatePrivate; >+ > typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) { > _WKWebsiteDataStoreFetchOptionComputeSizes = 1 << 0, > } WK_API_AVAILABLE(macosx(10.12), ios(10.0)); >@@ -62,6 +64,9 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) { > + (void)_allowWebsiteDataRecordsForAllOrigins WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); > - (bool)_hasRegisteredServiceWorker WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > >+/*! @abstract The storage quota delegate. */ >+@property (nullable, nonatomic, weak) id <WKStorageQuotaDelegatePrivate> _quotaDelegate WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+ > @end > > NS_ASSUME_NONNULL_END >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index 600c0bc39aec39269a8dfed9f5aece90e34224b9..568f3a9a8d7d068777bab7039d7192922b34e6f6 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -43,6 +43,8 @@ > #include "WebProcessPool.h" > #include "WebUserContentControllerProxy.h" > #include "WebsiteData.h" >+#include "WebsiteDataStoreQuotaManager.h" >+#include <WebCore/ClientOrigin.h> > #include <wtf/CompletionHandler.h> > > #if ENABLE(SEC_ITEM_SHIM) >@@ -743,8 +745,7 @@ void NetworkProcessProxy::requestCacheStorageSpace(PAL::SessionID sessionID, con > return; > } > >- // FIXME: Ask WebsiteDataStore about updating the quota for this origin. >- completionHandler(quota); >+ store->quotaManager().requestCacheStorageSpace(origin.topOrigin, origin.clientOrigin, quota, currentSize, spaceRequired, WTFMove(completionHandler)); > } > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index 0aabbe48db135d86bf284b05542143a17bd8e9a0..ba2163aa63837af70b626e815a43acdb5aa0247e 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -41,6 +41,7 @@ > #include "WebResourceLoadStatisticsStoreMessages.h" > #include "WebsiteData.h" > #include "WebsiteDataStoreParameters.h" >+#include "WebsiteDataStoreQuotaManager.h" > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/DatabaseTracker.h> > #include <WebCore/FileSystem.h> >@@ -97,6 +98,7 @@ WebsiteDataStore::WebsiteDataStore(Ref<WebsiteDataStoreConfiguration>&& configur > #if ENABLE(WEB_AUTHN) > , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>()) > #endif >+ , m_quotaManager(makeUniqueRef<WebsiteDataStoreQuotaManager>()) > { > WTF::setProcessPrivileges(allPrivileges()); > maybeRegisterWithSessionIDMap(); >@@ -114,6 +116,7 @@ WebsiteDataStore::WebsiteDataStore(PAL::SessionID sessionID) > #if ENABLE(WEB_AUTHN) > , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>()) > #endif >+ , m_quotaManager(makeUniqueRef<WebsiteDataStoreQuotaManager>()) > { > maybeRegisterWithSessionIDMap(); > platformInitialize(); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index 912d8e475cd6a217999a090178eb658fc2179c69..b4ae55ccfa3fbafccd8fdc186861a58a8e79451c 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >@@ -28,6 +28,7 @@ > #include "NetworkSessionCreationParameters.h" > #include "WebProcessLifetimeObserver.h" > #include "WebsiteDataStoreConfiguration.h" >+#include "WebsiteDataStoreQuotaManager.h" > #include <WebCore/Cookie.h> > #include <WebCore/SecurityOriginData.h> > #include <WebCore/SecurityOriginHash.h> >@@ -58,6 +59,7 @@ class SecurityOrigin; > namespace WebKit { > > class AuthenticatorManager; >+class WebsiteDataStoreQuotaManager; > class SecKeyProxyStore; > class StorageManager; > class DeviceIdHashSaltStorage; >@@ -188,6 +190,9 @@ public: > > const WebsiteDataStoreConfiguration& configuration() { return m_configuration.get(); } > >+ WebsiteDataStoreQuotaManager& quotaManager() { return m_quotaManager.get(); } >+ void setQuotaManager(UniqueRef<WebsiteDataStoreQuotaManager>&& manager) { m_quotaManager = WTFMove(manager); } >+ > private: > explicit WebsiteDataStore(PAL::SessionID); > explicit WebsiteDataStore(Ref<WebsiteDataStoreConfiguration>&&, PAL::SessionID); >@@ -256,6 +261,8 @@ private: > #if ENABLE(WEB_AUTHN) > UniqueRef<AuthenticatorManager> m_authenticatorManager; > #endif >+ >+ UniqueRef<WebsiteDataStoreQuotaManager> m_quotaManager; > }; > > } >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h >new file mode 100644 >index 0000000000000000000000000000000000000000..204ab4a7cf62cbf8bd824ea5d0b6f5bbdf18ee4b >--- /dev/null >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h >@@ -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 WebsiteDataStoreQuotaManager { >+public: >+ virtual ~WebsiteDataStoreQuotaManager() { } >+ >+ virtual void requestCacheStorageSpace(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& frameOrigin, uint64_t quota, uint64_t currentSize, uint64_t spaceRequired, WTF::CompletionHandler<void(Optional<uint64_t>)>&& completionHandler) >+ { >+ completionHandler({ }); >+ } >+}; >+ >+} // namespace WebKit >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 97141e837c52bcde0d5429371319f98b871c53df..2c3a76a2d0af407b886dae133bdd312ea2f6f3ef 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -859,6 +859,7 @@ > 4112EDDE20E407A500BEA92A /* com.cfca.npSecEditCtl.MAC.BOC.plugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 4112EDD320E4077400BEA92A /* com.cfca.npSecEditCtl.MAC.BOC.plugin.sb */; }; > 4112EDDF20E407A500BEA92A /* com.cmbchina.CMBSecurity.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 4112EDD520E4077400BEA92A /* com.cmbchina.CMBSecurity.sb */; }; > 4112EDE020E407A500BEA92A /* com.ftsafe.NPAPI-Core-Safe-SoftKeybaord.plugin.rfc1034identifier.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 4112EDD220E4077300BEA92A /* com.ftsafe.NPAPI-Core-Safe-SoftKeybaord.plugin.rfc1034identifier.sb */; }; >+ 4118DC1F21E7BF5D00DE04C7 /* WKStorageQuotaDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4118DC1D21E6DD2700DE04C7 /* WKStorageQuotaDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 411A8DDB20DDD1AC0060D34F /* WKMockMediaDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 411A8DD920DDB6050060D34F /* WKMockMediaDevice.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 411B22641E371BA6004F7363 /* LibWebRTCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 411B22621E371244004F7363 /* LibWebRTCNetwork.h */; }; > 413075AB1DE85F330039EC69 /* NetworkRTCSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075991DE84FB00039EC69 /* NetworkRTCSocket.h */; }; >@@ -2989,6 +2990,8 @@ > 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 /* WebsiteDataStoreQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataStoreQuotaManager.h; sourceTree = "<group>"; }; >+ 4118DC1D21E6DD2700DE04C7 /* WKStorageQuotaDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKStorageQuotaDelegatePrivate.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>"; }; >@@ -6133,6 +6136,7 @@ > 51CD1C611B34B9C900142CA5 /* WKSecurityOriginInternal.h */, > 93F549B31E3174B7000E7239 /* WKSnapshotConfiguration.h */, > 93F549B51E3174DA000E7239 /* WKSnapshotConfiguration.mm */, >+ 4118DC1D21E6DD2700DE04C7 /* WKStorageQuotaDelegatePrivate.h */, > 1AD8790918B6C38A006CAFD7 /* WKUIDelegate.h */, > 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */, > 51D1242D1E6DDDD7002B2820 /* WKURLSchemeHandler.h */, >@@ -9831,6 +9835,7 @@ > 513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */, > 93F549B41E3174B7000E7239 /* WKSnapshotConfiguration.h in Headers */, > 4118DC1F21E7BF5D00DE04C7 /* WKStorageQuotaDelegatePrivate.h in Headers */, >+ 4118DC1F21E7BF5D00DE04C7 /* WKStorageQuotaDelegatePrivate.h in Headers */, > BC407606124FF0270068F20A /* WKString.h in Headers */, > BC40761A124FF0370068F20A /* WKStringCF.h in Headers */, > BC9099801256A98200083756 /* WKStringPrivate.h in Headers */, >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index abbe4c1dc148c60b967d182f84d36a791a88bd91..2f2636ba68a06722424c3ab8d27675109485083b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,30 @@ >+2019-01-17 Youenn Fablet <youenn@apple.com> >+ >+ Add a new SPI to request for cache storage quota increase >+ https://bugs.webkit.org/show_bug.cgi?id=193323 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-17 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC] An element with transform is a containing block for positioned descendants. >diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >index 67fc93e91622bdd333185c7f6b208a39fee44516..f15550f530ed0f3d519478022695201e902cbab3 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >@@ -62,6 +62,7 @@ interface TestRunner { > void clearDOMCache(DOMString origin); > boolean hasDOMCache(DOMString origin); > unsigned long domCacheSize(DOMString origin); >+ void allowCacheStorageQuotaIncrease(); > > // Special options. > void keepWebHistory(); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index f97ae47b8d5fb2ead1be4f9597e1568f76df016a..d7a9d24829df8b74ad8bcd91ddd96094b2ce5850 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -2367,6 +2367,12 @@ uint64_t TestRunner::domCacheSize(JSStringRef origin) > 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); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >index 2214d77b8c3979a47c5e8edaa5d32712d14341d9..a401999f412e9bd3932ab81c84b7773d5df073f3 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >@@ -175,6 +175,7 @@ public: > void clearDOMCaches(); > bool hasDOMCache(JSStringRef origin); > uint64_t domCacheSize(JSStringRef origin); >+ void allowCacheStorageQuotaIncrease(); > > // IndexedDB > void setIDBPerOriginQuota(uint64_t); >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 7c88e0027f3d750be61567232a881adcdfb4dda8..7cb7f5cd9e85d57f634a70b4117f57f348558d77 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -2830,6 +2830,13 @@ uint64_t TestController::domCacheSize(WKStringRef origin) > return context.result; > } > >+#if !PLATFORM(COCOA) >+void TestController::allowCacheStorageQuotaIncrease() >+{ >+ // FIXME: To implement. >+} >+#endif >+ > struct ResourceStatisticsCallbackContext { > explicit ResourceStatisticsCallbackContext(TestController& controller) > : testController(controller) >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index 13a39c6905f0d87ba87b9db57f8dad5c17ac71bc..1425cbfd51a7604ae10c57944557aa06a20eac80 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -248,6 +248,7 @@ public: > void clearDOMCaches(); > bool hasDOMCache(WKStringRef origin); > uint64_t domCacheSize(WKStringRef origin); >+ void allowCacheStorageQuotaIncrease(); > > void setIDBPerOriginQuota(uint64_t); > >diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp >index 0c6c877ff1dab755ade28e9e234f44e55fd94c27..1d8d7d9be055b48662ad30e33707f027aeec5eb5 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.cpp >+++ b/Tools/WebKitTestRunner/TestInvocation.cpp >@@ -1428,6 +1428,11 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB > 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); >diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >index 2c1f6a63c9e49e7cce81dacb60dda2f8f5b18a83..352972d0a7c8413c2bb57053b2975e3a9dfc25a1 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -37,6 +37,7 @@ > #import <WebKit/WKCookieManager.h> > #import <WebKit/WKPreferencesRefPrivate.h> > #import <WebKit/WKProcessPoolPrivate.h> >+#import <WebKit/WKStorageQuotaDelegatePrivate.h> > #import <WebKit/WKStringCF.h> > #import <WebKit/WKUserContentControllerPrivate.h> > #import <WebKit/WKWebView.h> >@@ -51,10 +52,40 @@ > #import <WebKit/_WKUserContentExtensionStorePrivate.h> > #import <wtf/MainThread.h> > >+ >+#if WK_API_ENABLED >+ >+@interface CacheStorageQuotaManager: NSObject <WKStorageQuotaDelegatePrivate> { >+@public >+ BOOL shouldAllowRaisingQuota; >+} >+- (instancetype)init; >+@end >+ >+@implementation CacheStorageQuotaManager { } >+- (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); >+} >+ >+@end >+ >+#endif >+ > namespace WTR { > > static WKWebViewConfiguration *globalWebViewConfiguration; > >+#if WK_API_ENABLED >+static CacheStorageQuotaManager *globalCacheStorageQuotaManager; >+#endif >+ > void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injectedBundlePath, WKContextRef context, WKContextConfigurationRef contextConfiguration) > { > #if WK_API_ENABLED >@@ -80,6 +111,12 @@ void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injecte > [globalWebViewConfiguration.websiteDataStore _setResourceLoadStatisticsEnabled:YES]; > [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:NO]; > >+#if WK_API_ENABLED >+ [globalCacheStorageQuotaManager release]; >+ globalCacheStorageQuotaManager = [[CacheStorageQuotaManager alloc] init]; >+ [globalWebViewConfiguration.websiteDataStore set_quotaDelegate:globalCacheStorageQuotaManager]; >+#endif >+ > #if PLATFORM(IOS_FAMILY) > globalWebViewConfiguration.allowsInlineMediaPlayback = YES; > globalWebViewConfiguration._inlineMediaPlaybackRequiresPlaysInlineAttribute = NO; >@@ -252,6 +289,8 @@ void TestController::cocoaResetStateToConsistentValues(const TestOptions& option > if (options.shouldShowSpellCheckingDots) > [platformView toggleContinuousSpellChecking:nil]; > } >+ >+ globalCacheStorageQuotaManager->shouldAllowRaisingQuota = false; > #endif > } > >@@ -385,4 +424,11 @@ bool TestController::keyExistsInKeychain(const String& attrLabel, const String& > return false; > } > >+void TestController::allowCacheStorageQuotaIncrease() >+{ >+#if WK_API_ENABLED >+ globalCacheStorageQuotaManager->shouldAllowRaisingQuota = true; >+#endif >+} >+ > } // namespace WTR >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index e856254f6b5005505f8a1dd3c3c961e87901d7c1..ac054a276e308897a1dcc5c8cc6be4313e7a8f4f 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2019-01-17 Youenn Fablet <youenn@apple.com> >+ >+ Add a new SPI to request for cache storage quota increase >+ https://bugs.webkit.org/show_bug.cgi?id=193323 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Use new testRunner method to bump the cache quota and verify adding a >+ cache entry works when bumping the cqche quota. >+ >+ * http/wpt/cache-storage/cache-quota.any.js: >+ (promise_test): >+ > 2019-01-16 Alicia Boya GarcÃa <aboya@igalia.com> > > Unreviewed GTK and WPE test gardening. >diff --git a/LayoutTests/http/wpt/cache-storage/cache-quota.any.js b/LayoutTests/http/wpt/cache-storage/cache-quota.any.js >index 5a94d5b78f3b639ca70dcbf13ff288a5db2e2393..ca292dc9b549bc13e53c26d9e261e1ff0681b065 100644 >--- a/LayoutTests/http/wpt/cache-storage/cache-quota.any.js >+++ b/LayoutTests/http/wpt/cache-storage/cache-quota.any.js >@@ -114,7 +114,7 @@ promise_test((test) => { > 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,6 +151,9 @@ promise_test((test) => { > return cache.put("1ko", response1ko.clone()).then(assert_unreached, (e) => { > assert_equals(e.name, "QuotaExceededError"); > }); >+ }).then(() => { >+ testRunner.allowCacheStorageQuotaIncrease(); >+ return cache.put("1ko", response1ko.clone()); > }).then(() => { > return cache.delete("1ko-padded-to-200ko"); > }).then(() => {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193323
:
358810
|
359292
|
359293
|
359386
|
359394
|
359400
|
359413
|
359428
|
359497