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

Changeset 252412 in webkit


Ignore:
Timestamp:
Nov 13, 2019, 9:31:49 AM (7 years ago)
Author:
youenn@apple.com
Message:

[ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure
https://bugs.webkit.org/show_bug.cgi?id=203275
<rdar://problem/56516249>

Reviewed by Alex Christensen.

Source/WebKit:

Fix flakiness by clearing the storage of each cache when the cache is being cleared.
This ensures that the storage salt gets recreated if needed.

To further improve repeatability, make sure that initialize based tasks happen after clear tasks are complete.
For that purpose, add a clear task counter and append initialize callbacks to a Vector if counter is not zero.
Increment counter at clear task creation and decrement counter at completion time.
If counter is back to 0, we can safely process the pending clear tasks.

Covered by unflaked test.

  • NetworkProcess/cache/CacheStorageEngine.cpp:

(WebKit::CacheStorage::Engine::~Engine):
(WebKit::CacheStorage::Engine::initialize):
(WebKit::CacheStorage::CompletionHandler<void):
(WebKit::CacheStorage::Engine::clearAllCaches):
(WebKit::CacheStorage::Engine::clearCachesForOrigin):

  • NetworkProcess/cache/CacheStorageEngine.h:
  • NetworkProcess/cache/CacheStorageEngineCaches.cpp:

(WebKit::CacheStorage::Caches::clearMemoryRepresentation):

LayoutTests:

  • platform/ios-wk2/TestExpectations:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252406 r252412  
     12019-11-13  Youenn Fablet  <youenn@apple.com>
     2
     3        [ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure
     4        https://bugs.webkit.org/show_bug.cgi?id=203275
     5        <rdar://problem/56516249>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * platform/ios-wk2/TestExpectations:
     10
    1112019-11-13  Per Arne Vollan  <pvollan@apple.com>
    212
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r252140 r252412  
    13521352webkit.org/b/203264 [ Release ] editing/pasteboard/smart-paste-paragraph-004.html [ Pass Failure ]
    13531353
    1354 # <rdar://problem/56516249> REGRESSION (r250936?) [ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure (203275)
    1355 webkit.org/b/203275 http/tests/IndexedDB/storage-limit-1.https.html [ Pass Failure ]
    1356 
    13571354# <rdar://problem/56590026> [iOS] fast/forms/contenteditable- font-optical-size.html landed flaky (203371)
    13581355webkit.org/b/203371 fast/forms/contenteditable-font-optical-size.html [ Pass Failure ]
  • trunk/Source/WebKit/ChangeLog

    r252410 r252412  
     12019-11-13  Youenn Fablet  <youenn@apple.com>
     2
     3        [ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure
     4        https://bugs.webkit.org/show_bug.cgi?id=203275
     5        <rdar://problem/56516249>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Fix flakiness by clearing the storage of each cache when the cache is being cleared.
     10        This ensures that the storage salt gets recreated if needed.
     11
     12        To further improve repeatability, make sure that initialize based tasks happen after clear tasks are complete.
     13        For that purpose, add a clear task counter and append initialize callbacks to a Vector if counter is not zero.
     14        Increment counter at clear task creation and decrement counter at completion time.
     15        If counter is back to 0, we can safely process the pending clear tasks.
     16
     17        Covered by unflaked test.
     18
     19        * NetworkProcess/cache/CacheStorageEngine.cpp:
     20        (WebKit::CacheStorage::Engine::~Engine):
     21        (WebKit::CacheStorage::Engine::initialize):
     22        (WebKit::CacheStorage::CompletionHandler<void):
     23        (WebKit::CacheStorage::Engine::clearAllCaches):
     24        (WebKit::CacheStorage::Engine::clearCachesForOrigin):
     25        * NetworkProcess/cache/CacheStorageEngine.h:
     26        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
     27        (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
     28
    1292019-11-13  Chris Dumez  <cdumez@apple.com>
    230
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp

    r252381 r252412  
    6363        caches->detach();
    6464
     65    auto pendingClearCallbacks = WTFMove(m_pendingClearCallbacks);
     66    for (auto& callback : pendingClearCallbacks)
     67        callback(Error::Internal);
     68
    6569    auto initializationCallbacks = WTFMove(m_initializationCallbacks);
    6670    for (auto& callback : initializationCallbacks)
     
    290294void Engine::initialize(CompletionCallback&& callback)
    291295{
     296    if (m_clearTaskCounter || !m_pendingClearCallbacks.isEmpty()) {
     297        m_pendingClearCallbacks.append(WTFMove(callback));
     298        return;
     299    }
     300
    292301    if (m_salt) {
    293302        callback(WTF::nullopt);
     
    597606}
    598607
     608CompletionHandler<void()> Engine::createClearTask(CompletionHandler<void()>&& completionHandler)
     609{
     610    ++m_clearTaskCounter;
     611    return [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
     612        completionHandler();
     613        if (!--m_clearTaskCounter) {
     614            auto callbacks = WTFMove(m_pendingClearCallbacks);
     615            for (auto& callback : callbacks)
     616                initialize(WTFMove(callback));
     617        }
     618    };
     619}
     620
    599621void Engine::clearAllCaches(CompletionHandler<void()>&& completionHandler)
    600622{
    601623    ASSERT(RunLoop::isMain());
    602624
    603     auto callbackAggregator = CallbackAggregator::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
     625    auto callbackAggregator = CallbackAggregator::create([this, completionHandler = createClearTask(WTFMove(completionHandler))]() mutable {
    604626        if (!this->shouldPersist())
    605627            return completionHandler();
     
    630652    ASSERT(RunLoop::isMain());
    631653
    632     auto callbackAggregator = CallbackAggregator::create([this, protectedThis = makeRef(*this), origin, completionHandler = WTFMove(completionHandler)]() mutable {
     654    auto callbackAggregator = CallbackAggregator::create([this, origin, completionHandler = createClearTask(WTFMove(completionHandler))]() mutable {
    633655        if (!this->shouldPersist())
    634656            return completionHandler();
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h

    r252381 r252412  
    133133    void readCache(uint64_t cacheIdentifier, CacheCallback&&);
    134134
     135    CompletionHandler<void()> createClearTask(CompletionHandler<void()>&&);
     136
    135137    Cache* cache(uint64_t cacheIdentifier);
    136138
     
    147149    HashMap<uint64_t, CompletionHandler<void(const NetworkCache::Data&, int error)>> m_pendingReadCallbacks;
    148150    uint64_t m_pendingCallbacksCounter { 0 };
     151    Vector<WebCore::DOMCacheEngine::CompletionCallback> m_pendingClearCallbacks;
     152    uint64_t m_clearTaskCounter { 0 };
    149153};
    150154
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp

    r252381 r252412  
    635635void Caches::clearMemoryRepresentation()
    636636{
    637     if (!m_isInitialized) {
    638         ASSERT(!m_storage || !hasActiveCache() || !m_pendingInitializationCallbacks.isEmpty());
    639         // m_storage might not be null in case Caches is being initialized. This is fine as nullify it below is a memory optimization.
    640         m_caches.clear();
    641         return;
    642     }
    643 
    644637    makeDirty();
    645638    m_caches.clear();
Note: See TracChangeset for help on using the changeset viewer.