WebKit Bugzilla
Attachment 359400 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-20190117120316.patch (text/plain), 32.29 KB, created by
youenn fablet
on 2019-01-17 12:03:16 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-17 12:03:16 PST
Size:
32.29 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/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >index 2d160ea3b1288fe84dc1d8293c0a328381feb26a..e3faffc4aeddbf3b5a0c6aa8e98149f9a837d633 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >@@ -29,6 +29,7 @@ > #if WK_API_ENABLED > > #import "APIString.h" >+#import "CompletionHandlerCallChecker.h" > #import "WKHTTPCookieStoreInternal.h" > #import "WKNSArray.h" > #import "WKWebViewInternal.h" >@@ -38,9 +39,45 @@ > #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 WebsiteDataStoreManager : public WebKit::WebsiteDataStoreManager { >+public: >+ explicit WebsiteDataStoreManager(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 > >@@ -383,6 +420,17 @@ - (bool)_hasRegisteredServiceWorker > return WebKit::ServiceWorkerProcessProxy::hasRegisteredServiceWorkers(_websiteDataStore->websiteDataStore().serviceWorkerRegistrationDirectory()); > } > >+- (id <_WKWebsiteDataStoreDelegate>)_delegate >+{ >+ return _delegate.get(); >+} >+ >+- (void)set_delegate:(id <_WKWebsiteDataStoreDelegate>)delegate >+{ >+ _delegate = delegate; >+ _websiteDataStore->websiteDataStore().setManager(makeUniqueRef<WebsiteDataStoreManager>(delegate)); >+} >+ > @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..2c5b78e159927debbf45456a123f2bf7fe57e637 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 <_WKWebsiteDataStoreDelegate> > _delegate; > } > @end > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h >index 74a8a02f2f1d9ee95c97af9a96e3c60131920161..62aa8afd31ec4da593007919f05ffd246e202cf7 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 _WKWebsiteDataStoreDelegate; >+ > 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 <_WKWebsiteDataStoreDelegate> _delegate WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+ > @end > > NS_ASSUME_NONNULL_END >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKStorageQuotaDelegatePrivate.h b/Source/WebKit/UIProcess/API/Cocoa/_WKStorageQuotaDelegatePrivate.h >new file mode 100644 >index 0000000000000000000000000000000000000000..a2213df447074866a1a16ba2fe00c636a89bc5d6 >--- /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 _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 >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b84895ba5de714c36ac763b7de56b4ac1bc3a8c1 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.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 _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 >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index 600c0bc39aec39269a8dfed9f5aece90e34224b9..465dbad7a617fb6e5309c5f6f40bf594e41a9934 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 "WebsiteDataStoreManager.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->manager().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..553d5c809afd73849f22ad69fdfa76b4bec8ae35 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -40,6 +40,7 @@ > #include "WebResourceLoadStatisticsStore.h" > #include "WebResourceLoadStatisticsStoreMessages.h" > #include "WebsiteData.h" >+#include "WebsiteDataStoreManager.h" > #include "WebsiteDataStoreParameters.h" > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/DatabaseTracker.h> >@@ -97,6 +98,7 @@ WebsiteDataStore::WebsiteDataStore(Ref<WebsiteDataStoreConfiguration>&& configur > #if ENABLE(WEB_AUTHN) > , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>()) > #endif >+ , m_manager(makeUniqueRef<WebsiteDataStoreManager>()) > { > WTF::setProcessPrivileges(allPrivileges()); > maybeRegisterWithSessionIDMap(); >@@ -114,6 +116,7 @@ WebsiteDataStore::WebsiteDataStore(PAL::SessionID sessionID) > #if ENABLE(WEB_AUTHN) > , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>()) > #endif >+ , m_manager(makeUniqueRef<WebsiteDataStoreManager>()) > { > maybeRegisterWithSessionIDMap(); > platformInitialize(); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index 912d8e475cd6a217999a090178eb658fc2179c69..c746b4c90742d9c94e73224ca9db9e9b041b6160 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 "WebsiteDataStoreManager.h" > #include <WebCore/Cookie.h> > #include <WebCore/SecurityOriginData.h> > #include <WebCore/SecurityOriginHash.h> >@@ -188,6 +189,9 @@ public: > > const WebsiteDataStoreConfiguration& configuration() { return m_configuration.get(); } > >+ WebsiteDataStoreManager& manager() { return m_manager.get(); } >+ void setManager(UniqueRef<WebsiteDataStoreManager>&& manager) { m_manager = WTFMove(manager); } >+ > private: > explicit WebsiteDataStore(PAL::SessionID); > explicit WebsiteDataStore(Ref<WebsiteDataStoreConfiguration>&&, PAL::SessionID); >@@ -256,6 +260,8 @@ private: > #if ENABLE(WEB_AUTHN) > UniqueRef<AuthenticatorManager> m_authenticatorManager; > #endif >+ >+ UniqueRef<WebsiteDataStoreManager> m_manager; > }; > > } >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreManager.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreManager.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7fb2fd288d467ab865bbe40a8042beb67e1faf44 >--- /dev/null >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreManager.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 WebsiteDataStoreManager { >+public: >+ virtual ~WebsiteDataStoreManager() { } >+ >+ 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 >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 97141e837c52bcde0d5429371319f98b871c53df..7a60d61f75a9fb327b95504be87cc8e7d2f917fa 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 /* _WKWebsiteDataStoreDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4118DC1D21E6DD2700DE04C7 /* _WKWebsiteDataStoreDelegate.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 /* WebsiteDataStoreManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataStoreManager.h; sourceTree = "<group>"; }; >+ 4118DC1D21E6DD2700DE04C7 /* _WKWebsiteDataStoreDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataStoreDelegate.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>"; }; >@@ -4844,7 +4847,7 @@ > 1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */, > 5C46C0AC21B7198B00BC5991 /* WebsiteDataStoreConfiguration.cpp */, > 5C46C0AD21B7198C00BC5991 /* WebsiteDataStoreConfiguration.h */, >- 4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreQuotaManager.h */, >+ 4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreManager.h */, > ); > path = WebsiteData; > sourceTree = "<group>"; >@@ -6024,6 +6027,7 @@ > 1A002D3F196B329400B9AD44 /* _WKSessionState.h */, > 1A002D3E196B329400B9AD44 /* _WKSessionState.mm */, > 1A002D42196B337000B9AD44 /* _WKSessionStateInternal.h */, >+ 4118DC1D21E6DD2700DE04C7 /* _WKWebsiteDataStoreDelegate.h */, > 2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */, > 2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */, > 2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */, >@@ -9830,7 +9834,8 @@ > 1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */, > 513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */, > 93F549B41E3174B7000E7239 /* WKSnapshotConfiguration.h in Headers */, >- 4118DC1F21E7BF5D00DE04C7 /* WKStorageQuotaDelegatePrivate.h in Headers */, >+ 4118DC1F21E7BF5D00DE04C7 /* _WKWebsiteDataStoreDelegate.h in Headers */, >+ 4118DC1F21E7BF5D00DE04C7 /* _WKWebsiteDataStoreDelegate.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..c193d0616194a203d8c7fed31953dee3b38d7364 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -49,12 +49,43 @@ > #import <WebKit/_WKApplicationManifest.h> > #import <WebKit/_WKUserContentExtensionStore.h> > #import <WebKit/_WKUserContentExtensionStorePrivate.h> >+#import <WebKit/_WKWebsiteDataStoreDelegate.h> > #import <wtf/MainThread.h> > >+ >+#if WK_API_ENABLED >+ >+@interface WebsiteDataStoreDelegateManager: NSObject <_WKWebsiteDataStoreDelegate> { >+@public >+ BOOL shouldAllowRaisingQuota; >+} >+- (instancetype)init; >+@end >+ >+@implementation WebsiteDataStoreDelegateManager { } >+- (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 WebsiteDataStoreDelegateManager *globalWebsiteDataStoreDelegateManager; >+#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 >+ [globalWebsiteDataStoreDelegateManager release]; >+ globalWebsiteDataStoreDelegateManager = [[WebsiteDataStoreDelegateManager alloc] init]; >+ [globalWebViewConfiguration.websiteDataStore set_delegate:globalWebsiteDataStoreDelegateManager]; >+#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]; > } >+ >+ globalWebsiteDataStoreDelegateManager->shouldAllowRaisingQuota = false; > #endif > } > >@@ -385,4 +424,11 @@ bool TestController::keyExistsInKeychain(const String& attrLabel, const String& > return false; > } > >+void TestController::allowCacheStorageQuotaIncrease() >+{ >+#if WK_API_ENABLED >+ globalWebsiteDataStoreDelegateManager->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..f79d32850cc5337da3e7769ffe5a0a2b22c6401a 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,7 +151,10 @@ promise_test((test) => { > 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());
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