WebKit Bugzilla
Attachment 370464 Details for
Bug 198133
: Set default WebsiteDataStore storage quota based on StorageQuotaManager
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198133-20190522162320.patch (text/plain), 6.21 KB, created by
youenn fablet
on 2019-05-22 16:23:20 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-05-22 16:23:20 PDT
Size:
6.21 KB
patch
obsolete
>Subversion Revision: 245568 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b48feba90021ad494c3a177fae78b72b2e1fa346..6f4e603156a581d8f828847b863071ebb60d51dd 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,13 @@ >+2019-05-22 Youenn Fablet <youenn@apple.com> >+ >+ Set default WebsiteDataStore storage quota based on StorageQuotaManager >+ https://bugs.webkit.org/show_bug.cgi?id=198133 >+ <rdar://problem/51031436> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: >+ > 2019-05-22 Youenn Fablet <youenn@apple.com> > > CacheStorageConnection callbacks should be completed on network connection close >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h >index 9cc8a5079bc0afea42919706b062128b57fcb20b..df17adc5e4d32d021558e6494a3e369787f59f70 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h >@@ -26,6 +26,7 @@ > #pragma once > > #include "APIObject.h" >+#include <WebCore/StorageQuotaManager.h> > #include <wtf/URL.h> > #include <wtf/text/WTFString.h> > >@@ -97,13 +98,11 @@ public: > const URL& httpsProxy() const { return m_httpsProxy; } > void setHTTPSProxy(URL&& proxy) { m_httpsProxy = WTFMove(proxy); } > >- constexpr static uint64_t defaultPerOriginStorageQuota = 50 * 1024 * 1024; >- > private: > WebsiteDataStoreConfiguration(); > > String m_cacheStorageDirectory; >- uint64_t m_perOriginStorageQuota { defaultPerOriginStorageQuota }; >+ uint64_t m_perOriginStorageQuota { WebCore::StorageQuotaManager::defaultQuota() }; > String m_networkCacheDirectory; > String m_applicationCacheDirectory; > String m_applicationCacheFlatFileSubdirectoryName; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 81eabc75e282715dfd8c4ee93533903066283a7f..0afd261da7f98f4e8d4acc866f674230f150732f 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-22 Youenn Fablet <youenn@apple.com> >+ >+ Set default WebsiteDataStore storage quota based on StorageQuotaManager >+ https://bugs.webkit.org/show_bug.cgi?id=198133 >+ <rdar://problem/51031436> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm: >+ (doTest): >+ > 2019-05-21 Carlos Garcia Campos <cgarcia@igalia.com> > > Unreviewed. Fix the build with HAVE(ACCESSIBILITY) disabled >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm >index ef3161b235b4179e777ad9ae702f895d2cc2637f..8ce850c3a63b5832b737aebf1e3ad2b140ab2a40 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm >@@ -28,6 +28,7 @@ > > #import "PlatformUtilities.h" > #import "Test.h" >+#import "TestNavigationDelegate.h" > #import "TestWKWebView.h" > #import <WebKit/WKPreferencesPrivate.h> > #import <WebKit/WKProcessPoolPrivate.h> >@@ -41,11 +42,14 @@ > #import <wtf/HashMap.h> > #import <wtf/RetainPtr.h> > #import <wtf/Vector.h> >+#include <wtf/text/StringConcatenateNumbers.h> > #import <wtf/text/StringHash.h> > #import <wtf/text/WTFString.h> > > using namespace TestWebKitAPI; > >+static bool didFinishNavigation; >+ > @interface QuotaDelegate : NSObject <WKUIDelegate> > -(bool)quotaDelegateCalled; > -(void)grantQuota; >@@ -182,6 +186,31 @@ function doTestAgain() > </script> > )SWRESOURCE"; > >+static const char* TestUrlBytes = R"SWRESOURCE( >+<script> >+ >+var index = 0; >+async function test(num) >+{ >+ index++; >+ url = "http://example.org/test" + index; >+ >+ const cache = await window.caches.open("mycache"); >+ const promise = cache.put(url, new Response(new ArrayBuffer(num * 1024 * 1024))); >+ promise.then(() => { >+ window.webkit.messageHandlers.qt.postMessage("pass"); >+ }, () => { >+ window.webkit.messageHandlers.qt.postMessage("fail"); >+ }); >+} >+ >+function doTest(num) >+{ >+ test(num); >+} >+</script> >+)SWRESOURCE"; >+ > static bool done; > > static inline void setVisible(TestWKWebView *webView) >@@ -349,3 +378,48 @@ TEST(WebKit, QuotaDelegateNavigateFragment) > > EXPECT_FALSE(receivedQuotaDelegateCalled); > } >+ >+TEST(WebKit, DefaultQuota) >+{ >+ done = false; >+ [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() { >+ done = true; >+ }]; >+ TestWebKitAPI::Util::run(&done); >+ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ >+ auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]); >+ [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"]; >+ >+ auto handler = adoptNS([[StorageSchemes alloc] init]); >+ handler->resources.set("qt://test1.html", ResourceInfo { @"text/html", TestUrlBytes }); >+ [configuration setURLSchemeHandler:handler.get() forURLScheme:@"QT"]; >+ [configuration.get().processPool _registerURLSchemeServiceWorkersCanHandle:@"qt"]; >+ >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]); >+ auto delegate = adoptNS([[QuotaDelegate alloc] init]); >+ [webView setUIDelegate:delegate.get()]; >+ setVisible(webView.get()); >+ >+ auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]); >+ [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) { >+ didFinishNavigation = true; >+ }]; >+ [webView setNavigationDelegate:navigationDelegate.get()]; >+ >+ didFinishNavigation = false; >+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"qt://test1.html"]]]; >+ Util::run(&didFinishNavigation); >+ >+ receivedQuotaDelegateCalled = false; >+ >+ // Storing 10 entries of 10 MB should not hit the default quota which is 1GB >+ for (int i = 0; i < 10; ++i) { >+ [webView stringByEvaluatingJavaScript:makeString("doTest(10)")]; >+ [messageHandler setExpectedMessage: @"pass"]; >+ receivedMessage = false; >+ Util::run(&receivedMessage); >+ } >+ EXPECT_FALSE(receivedQuotaDelegateCalled); >+}
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 198133
:
370422
| 370464