Changeset 245698 in webkit
- Timestamp:
- May 23, 2019 11:08:01 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r245691 r245698 1 2019-05-23 Youenn Fablet <youenn@apple.com> 2 3 Set default WebsiteDataStore storage quota based on StorageQuotaManager 4 https://bugs.webkit.org/show_bug.cgi?id=198133 5 <rdar://problem/51031436> 6 7 Reviewed by Geoffrey Garen. 8 9 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 10 1 11 2019-05-23 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h
r243911 r245698 27 27 28 28 #include "APIObject.h" 29 #include <WebCore/StorageQuotaManager.h> 29 30 #include <wtf/URL.h> 30 31 #include <wtf/text/WTFString.h> … … 98 99 void setHTTPSProxy(URL&& proxy) { m_httpsProxy = WTFMove(proxy); } 99 100 100 constexpr static uint64_t defaultPerOriginStorageQuota = 50 * 1024 * 1024;101 102 101 private: 103 102 WebsiteDataStoreConfiguration(); 104 103 105 104 String m_cacheStorageDirectory; 106 uint64_t m_perOriginStorageQuota { defaultPerOriginStorageQuota};105 uint64_t m_perOriginStorageQuota { WebCore::StorageQuotaManager::defaultQuota() }; 107 106 String m_networkCacheDirectory; 108 107 String m_applicationCacheDirectory; -
trunk/Tools/ChangeLog
r245692 r245698 1 2019-05-23 Youenn Fablet <youenn@apple.com> 2 3 Set default WebsiteDataStore storage quota based on StorageQuotaManager 4 https://bugs.webkit.org/show_bug.cgi?id=198133 5 <rdar://problem/51031436> 6 7 Reviewed by Geoffrey Garen. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm: 10 (doTest): 11 1 12 2019-05-23 Keith Rollin <krollin@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm
r245328 r245698 29 29 #import "PlatformUtilities.h" 30 30 #import "Test.h" 31 #import "TestNavigationDelegate.h" 31 32 #import "TestWKWebView.h" 32 33 #import <WebKit/WKPreferencesPrivate.h> … … 42 43 #import <wtf/RetainPtr.h> 43 44 #import <wtf/Vector.h> 45 #include <wtf/text/StringConcatenateNumbers.h> 44 46 #import <wtf/text/StringHash.h> 45 47 #import <wtf/text/WTFString.h> 46 48 47 49 using namespace TestWebKitAPI; 50 51 static bool didFinishNavigation; 48 52 49 53 @interface QuotaDelegate : NSObject <WKUIDelegate> … … 183 187 )SWRESOURCE"; 184 188 189 static const char* TestUrlBytes = R"SWRESOURCE( 190 <script> 191 192 var index = 0; 193 async function test(num) 194 { 195 index++; 196 url = "http://example.org/test" + index; 197 198 const cache = await window.caches.open("mycache"); 199 const promise = cache.put(url, new Response(new ArrayBuffer(num * 1024 * 1024))); 200 promise.then(() => { 201 window.webkit.messageHandlers.qt.postMessage("pass"); 202 }, () => { 203 window.webkit.messageHandlers.qt.postMessage("fail"); 204 }); 205 } 206 207 function doTest(num) 208 { 209 test(num); 210 } 211 </script> 212 )SWRESOURCE"; 213 185 214 static bool done; 186 215 … … 350 379 EXPECT_FALSE(receivedQuotaDelegateCalled); 351 380 } 381 382 TEST(WebKit, DefaultQuota) 383 { 384 done = false; 385 [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() { 386 done = true; 387 }]; 388 TestWebKitAPI::Util::run(&done); 389 390 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 391 392 auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]); 393 [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"]; 394 395 auto handler = adoptNS([[StorageSchemes alloc] init]); 396 handler->resources.set("qt://test1.html", ResourceInfo { @"text/html", TestUrlBytes }); 397 [configuration setURLSchemeHandler:handler.get() forURLScheme:@"QT"]; 398 [configuration.get().processPool _registerURLSchemeServiceWorkersCanHandle:@"qt"]; 399 400 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]); 401 auto delegate = adoptNS([[QuotaDelegate alloc] init]); 402 [webView setUIDelegate:delegate.get()]; 403 setVisible(webView.get()); 404 405 auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]); 406 [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) { 407 didFinishNavigation = true; 408 }]; 409 [webView setNavigationDelegate:navigationDelegate.get()]; 410 411 didFinishNavigation = false; 412 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"qt://test1.html"]]]; 413 Util::run(&didFinishNavigation); 414 415 receivedQuotaDelegateCalled = false; 416 417 // Storing 10 entries of 10 MB should not hit the default quota which is 1GB 418 for (int i = 0; i < 10; ++i) { 419 [webView stringByEvaluatingJavaScript:makeString("doTest(10)")]; 420 [messageHandler setExpectedMessage: @"pass"]; 421 receivedMessage = false; 422 Util::run(&receivedMessage); 423 } 424 EXPECT_FALSE(receivedQuotaDelegateCalled); 425 }
Note: See TracChangeset
for help on using the changeset viewer.