Title: [242727] trunk
Revision
242727
Author
[email protected]
Date
2019-03-11 12:38:04 -0700 (Mon, 11 Mar 2019)

Log Message

Allow storage quota increase by default in WTR
https://bugs.webkit.org/show_bug.cgi?id=195541

Reviewed by Geoffrey Garen.

Tools:

Allow storage quota increase by default in WTR.
Move from testRunner.allowStorageQuotaIncrease to testRunner.setAllowStorageQuotaIncrease.
Use this for tests that explicitly need cache increase.

Instead of increasing quota by 2, make sure the next request is
granted by adding all given parameters.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setAllowStorageQuotaIncrease):
(WTR::TestRunner::allowCacheStorageQuotaIncrease): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setAllowStorageQuotaIncrease):
(WTR::TestController::allowCacheStorageQuotaIncrease): Deleted.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::TestController::setAllowStorageQuotaIncrease):
(WTR::TestController::allowCacheStorageQuotaIncrease): Deleted.
* WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm:
(-[TestWebsiteDataStoreDelegate requestStorageSpace:frameOrigin:quota:currentSize:spaceRequired:decisionHandler:]):

LayoutTests:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242726 => 242727)


--- trunk/LayoutTests/ChangeLog	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/LayoutTests/ChangeLog	2019-03-11 19:38:04 UTC (rev 242727)
@@ -1,3 +1,13 @@
+2019-03-11  Youenn Fablet  <[email protected]>
+
+        Allow storage quota increase by default in WTR
+        https://bugs.webkit.org/show_bug.cgi?id=195541
+
+        Reviewed by Geoffrey Garen.
+
+        * http/wpt/cache-storage/cache-quota.any.js:
+        (promise_test):
+
 2019-03-11  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r242688, r242643, r242624.

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


--- trunk/LayoutTests/http/wpt/cache-storage/cache-quota.any.js	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/LayoutTests/http/wpt/cache-storage/cache-quota.any.js	2019-03-11 19:38:04 UTC (rev 242727)
@@ -4,6 +4,9 @@
 var test_url = 'https://example.com/foo';
 var test_body = 'Hello world!';
 
+if (window.testRunner)
+    testRunner.setAllowStorageQuotaIncrease(false);
+
 function getResponseBodySizeWithPadding(response)
 {
     var cache;
@@ -128,7 +131,7 @@
 }, 'Hitting cache quota for non opaque responses');
 
 promise_test((test) => {
-    if (!window.internals)
+    if (!window.internals || !window.testRunner)
         return Promise.reject("Test requires internals");
 
     var cache;
@@ -152,7 +155,7 @@
             assert_equals(e.name, "QuotaExceededError");
         });
     }).then(() => {
-        testRunner.allowCacheStorageQuotaIncrease();
+        testRunner.setAllowStorageQuotaIncrease(true);
         return cache.put("1ko", response1ko.clone());
     }).then(() => {
         return cache.delete("1ko-padded-to-200ko");

Modified: trunk/Tools/ChangeLog (242726 => 242727)


--- trunk/Tools/ChangeLog	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/ChangeLog	2019-03-11 19:38:04 UTC (rev 242727)
@@ -1,3 +1,35 @@
+2019-03-11  Youenn Fablet  <[email protected]>
+
+        Allow storage quota increase by default in WTR
+        https://bugs.webkit.org/show_bug.cgi?id=195541
+
+        Reviewed by Geoffrey Garen.
+
+        Allow storage quota increase by default in WTR.
+        Move from testRunner.allowStorageQuotaIncrease to testRunner.setAllowStorageQuotaIncrease.
+        Use this for tests that explicitly need cache increase.
+
+        Instead of increasing quota by 2, make sure the next request is
+        granted by adding all given parameters.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setAllowStorageQuotaIncrease):
+        (WTR::TestRunner::allowCacheStorageQuotaIncrease): Deleted.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::setAllowStorageQuotaIncrease):
+        (WTR::TestController::allowCacheStorageQuotaIncrease): Deleted.
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::cocoaResetStateToConsistentValues):
+        (WTR::TestController::setAllowStorageQuotaIncrease):
+        (WTR::TestController::allowCacheStorageQuotaIncrease): Deleted.
+        * WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm:
+        (-[TestWebsiteDataStoreDelegate requestStorageSpace:frameOrigin:quota:currentSize:spaceRequired:decisionHandler:]):
+
 2019-03-11  Xan Lopez  <[email protected]>
 
         [CMake] Build 32bit binaries on Linux/64bit when the --32-bit is passed to build-jsc

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-03-11 19:38:04 UTC (rev 242727)
@@ -63,7 +63,7 @@
     void clearDOMCache(DOMString origin);
     boolean hasDOMCache(DOMString origin);
     unsigned long domCacheSize(DOMString origin);
-    void allowCacheStorageQuotaIncrease();
+    void setAllowStorageQuotaIncrease(boolean value);
 
     // Special options.
     void keepWebHistory();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2019-03-11 19:38:04 UTC (rev 242727)
@@ -2419,10 +2419,11 @@
     return WKUInt64GetValue(static_cast<WKUInt64Ref>(returnData));
 }
 
-void TestRunner::allowCacheStorageQuotaIncrease()
+void TestRunner::setAllowStorageQuotaIncrease(bool willIncrease)
 {
-    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("AllowCacheStorageQuotaIncrease"));
-    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAllowStorageQuotaIncrease"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(willIncrease));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
 }
 
 void TestRunner::getApplicationManifestThen(JSValueRef callback)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-03-11 19:38:04 UTC (rev 242727)
@@ -175,7 +175,7 @@
     void clearDOMCaches();
     bool hasDOMCache(JSStringRef origin);
     uint64_t domCacheSize(JSStringRef origin);
-    void allowCacheStorageQuotaIncrease();
+    void setAllowStorageQuotaIncrease(bool);
 
     // IndexedDB
     void setIDBPerOriginQuota(uint64_t);

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2019-03-11 19:38:04 UTC (rev 242727)
@@ -3040,7 +3040,7 @@
 }
 
 #if !PLATFORM(COCOA)
-void TestController::allowCacheStorageQuotaIncrease()
+void TestController::setAllowStorageQuotaIncrease(bool)
 {
     // FIXME: To implement.
 }

Modified: trunk/Tools/WebKitTestRunner/TestController.h (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/TestController.h	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2019-03-11 19:38:04 UTC (rev 242727)
@@ -262,8 +262,9 @@
     void clearDOMCaches();
     bool hasDOMCache(WKStringRef origin);
     uint64_t domCacheSize(WKStringRef origin);
-    void allowCacheStorageQuotaIncrease();
 
+    void setAllowStorageQuotaIncrease(bool);
+
     void setIDBPerOriginQuota(uint64_t);
 
     bool didReceiveServerRedirectForProvisionalNavigation() const { return m_didReceiveServerRedirectForProvisionalNavigation; }

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2019-03-11 19:38:04 UTC (rev 242727)
@@ -1463,8 +1463,10 @@
         return result;
     }
 
-    if (WKStringIsEqualToUTF8CString(messageName, "AllowCacheStorageQuotaIncrease")) {
-        TestController::singleton().allowCacheStorageQuotaIncrease();
+    if (WKStringIsEqualToUTF8CString(messageName, "SetAllowStorageQuotaIncrease")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        auto canIncrease = WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody));
+        TestController::singleton().setAllowStorageQuotaIncrease(canIncrease);
         return nullptr;
     }
 

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2019-03-11 19:38:04 UTC (rev 242727)
@@ -242,7 +242,7 @@
             [platformView toggleContinuousSpellChecking:nil];
     }
 
-    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: false];
+    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: true];
 }
 
 void TestController::platformWillRunTest(const TestInvocation& testInvocation)
@@ -369,9 +369,9 @@
     return false;
 }
 
-void TestController::allowCacheStorageQuotaIncrease()
+void TestController::setAllowStorageQuotaIncrease(bool value)
 {
-    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: true];
+    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: value];
 }
 
 bool TestController::canDoServerTrustEvaluationInNetworkProcess() const

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm (242726 => 242727)


--- trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm	2019-03-11 19:30:42 UTC (rev 242726)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm	2019-03-11 19:38:04 UTC (rev 242727)
@@ -33,9 +33,9 @@
     return self;
 }
 
-- (void)requestStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long quota))decisionHandler
+- (void)requestStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long))decisionHandler
 {
-    decisionHandler(_shouldAllowRaisingQuota ? 2 * quota : quota);
+    decisionHandler(_shouldAllowRaisingQuota ? quota + currentSize + spaceRequired : quota);
 }
 
 - (void)setAllowRaisingQuota:(BOOL)shouldAllowRaisingQuota
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to