⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242727 in webkit


Ignore:
Timestamp:
Mar 11, 2019, 12:38:04 PM (7 years ago)
Author:
youenn@apple.com
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):

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242714 r242727  
     12019-03-11  Youenn Fablet  <youenn@apple.com>
     2
     3        Allow storage quota increase by default in WTR
     4        https://bugs.webkit.org/show_bug.cgi?id=195541
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * http/wpt/cache-storage/cache-quota.any.js:
     9        (promise_test):
     10
    1112019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
    212
  • trunk/LayoutTests/http/wpt/cache-storage/cache-quota.any.js

    r240156 r242727  
    44var test_url = 'https://example.com/foo';
    55var test_body = 'Hello world!';
     6
     7if (window.testRunner)
     8    testRunner.setAllowStorageQuotaIncrease(false);
    69
    710function getResponseBodySizeWithPadding(response)
     
    129132
    130133promise_test((test) => {
    131     if (!window.internals)
     134    if (!window.internals || !window.testRunner)
    132135        return Promise.reject("Test requires internals");
    133136
     
    153156        });
    154157    }).then(() => {
    155         testRunner.allowCacheStorageQuotaIncrease();
     158        testRunner.setAllowStorageQuotaIncrease(true);
    156159        return cache.put("1ko", response1ko.clone());
    157160    }).then(() => {
  • trunk/Tools/ChangeLog

    r242724 r242727  
     12019-03-11  Youenn Fablet  <youenn@apple.com>
     2
     3        Allow storage quota increase by default in WTR
     4        https://bugs.webkit.org/show_bug.cgi?id=195541
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Allow storage quota increase by default in WTR.
     9        Move from testRunner.allowStorageQuotaIncrease to testRunner.setAllowStorageQuotaIncrease.
     10        Use this for tests that explicitly need cache increase.
     11
     12        Instead of increasing quota by 2, make sure the next request is
     13        granted by adding all given parameters.
     14
     15        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     16        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     17        (WTR::TestRunner::setAllowStorageQuotaIncrease):
     18        (WTR::TestRunner::allowCacheStorageQuotaIncrease): Deleted.
     19        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     20        * WebKitTestRunner/TestController.cpp:
     21        (WTR::TestController::setAllowStorageQuotaIncrease):
     22        (WTR::TestController::allowCacheStorageQuotaIncrease): Deleted.
     23        * WebKitTestRunner/TestController.h:
     24        * WebKitTestRunner/TestInvocation.cpp:
     25        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
     26        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
     27        (WTR::TestController::cocoaResetStateToConsistentValues):
     28        (WTR::TestController::setAllowStorageQuotaIncrease):
     29        (WTR::TestController::allowCacheStorageQuotaIncrease): Deleted.
     30        * WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm:
     31        (-[TestWebsiteDataStoreDelegate requestStorageSpace:frameOrigin:quota:currentSize:spaceRequired:decisionHandler:]):
     32
    1332019-03-11  Xan Lopez  <xan@igalia.com>
    234
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r242712 r242727  
    6464    boolean hasDOMCache(DOMString origin);
    6565    unsigned long domCacheSize(DOMString origin);
    66     void allowCacheStorageQuotaIncrease();
     66    void setAllowStorageQuotaIncrease(boolean value);
    6767
    6868    // Special options.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r242712 r242727  
    24202420}
    24212421
    2422 void TestRunner::allowCacheStorageQuotaIncrease()
    2423 {
    2424     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("AllowCacheStorageQuotaIncrease"));
    2425     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
     2422void TestRunner::setAllowStorageQuotaIncrease(bool willIncrease)
     2423{
     2424    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAllowStorageQuotaIncrease"));
     2425    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(willIncrease));
     2426    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
    24262427}
    24272428
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r242712 r242727  
    176176    bool hasDOMCache(JSStringRef origin);
    177177    uint64_t domCacheSize(JSStringRef origin);
    178     void allowCacheStorageQuotaIncrease();
     178    void setAllowStorageQuotaIncrease(bool);
    179179
    180180    // IndexedDB
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r242712 r242727  
    30413041
    30423042#if !PLATFORM(COCOA)
    3043 void TestController::allowCacheStorageQuotaIncrease()
     3043void TestController::setAllowStorageQuotaIncrease(bool)
    30443044{
    30453045    // FIXME: To implement.
  • trunk/Tools/WebKitTestRunner/TestController.h

    r242712 r242727  
    263263    bool hasDOMCache(WKStringRef origin);
    264264    uint64_t domCacheSize(WKStringRef origin);
    265     void allowCacheStorageQuotaIncrease();
     265
     266    void setAllowStorageQuotaIncrease(bool);
    266267
    267268    void setIDBPerOriginQuota(uint64_t);
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r242712 r242727  
    14641464    }
    14651465
    1466     if (WKStringIsEqualToUTF8CString(messageName, "AllowCacheStorageQuotaIncrease")) {
    1467         TestController::singleton().allowCacheStorageQuotaIncrease();
     1466    if (WKStringIsEqualToUTF8CString(messageName, "SetAllowStorageQuotaIncrease")) {
     1467        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
     1468        auto canIncrease = WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody));
     1469        TestController::singleton().setAllowStorageQuotaIncrease(canIncrease);
    14681470        return nullptr;
    14691471    }
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r242339 r242727  
    243243    }
    244244
    245     [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: false];
     245    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: true];
    246246}
    247247
     
    370370}
    371371
    372 void TestController::allowCacheStorageQuotaIncrease()
    373 {
    374     [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: true];
     372void TestController::setAllowStorageQuotaIncrease(bool value)
     373{
     374    [globalWebsiteDataStoreDelegateClient setAllowRaisingQuota: value];
    375375}
    376376
  • trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm

    r242497 r242727  
    3434}
    3535
    36 - (void)requestStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long quota))decisionHandler
     36- (void)requestStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long))decisionHandler
    3737{
    38     decisionHandler(_shouldAllowRaisingQuota ? 2 * quota : quota);
     38    decisionHandler(_shouldAllowRaisingQuota ? quota + currentSize + spaceRequired : quota);
    3939}
    4040
Note: See TracChangeset for help on using the changeset viewer.