- Revision
- 252412
- Author
- [email protected]
- Date
- 2019-11-13 09:31:49 -0800 (Wed, 13 Nov 2019)
Log 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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (252411 => 252412)
--- trunk/LayoutTests/ChangeLog 2019-11-13 16:21:56 UTC (rev 252411)
+++ trunk/LayoutTests/ChangeLog 2019-11-13 17:31:49 UTC (rev 252412)
@@ -1,3 +1,13 @@
+2019-11-13 Youenn Fablet <[email protected]>
+
+ [ 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.
+
+ * platform/ios-wk2/TestExpectations:
+
2019-11-13 Per Arne Vollan <[email protected]>
REGRESSION: some layout test are failing on Win EWS
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (252411 => 252412)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2019-11-13 16:21:56 UTC (rev 252411)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2019-11-13 17:31:49 UTC (rev 252412)
@@ -1351,9 +1351,6 @@
webkit.org/b/203264 [ Release ] editing/pasteboard/smart-paste-paragraph-003.html [ Pass Failure ]
webkit.org/b/203264 [ Release ] editing/pasteboard/smart-paste-paragraph-004.html [ Pass Failure ]
-# <rdar://problem/56516249> REGRESSION (r250936?) [ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure (203275)
-webkit.org/b/203275 http/tests/IndexedDB/storage-limit-1.https.html [ Pass Failure ]
-
# <rdar://problem/56590026> [iOS] fast/forms/contenteditable- font-optical-size.html landed flaky (203371)
webkit.org/b/203371 fast/forms/contenteditable-font-optical-size.html [ Pass Failure ]
Modified: trunk/Source/WebKit/ChangeLog (252411 => 252412)
--- trunk/Source/WebKit/ChangeLog 2019-11-13 16:21:56 UTC (rev 252411)
+++ trunk/Source/WebKit/ChangeLog 2019-11-13 17:31:49 UTC (rev 252412)
@@ -1,3 +1,31 @@
+2019-11-13 Youenn Fablet <[email protected]>
+
+ [ 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.
+
+ 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):
+
2019-11-13 Chris Dumez <[email protected]>
Rollout(r251358) Causes load hangs
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (252411 => 252412)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2019-11-13 16:21:56 UTC (rev 252411)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2019-11-13 17:31:49 UTC (rev 252412)
@@ -62,6 +62,10 @@
for (auto& caches : m_caches.values())
caches->detach();
+ auto pendingClearCallbacks = WTFMove(m_pendingClearCallbacks);
+ for (auto& callback : pendingClearCallbacks)
+ callback(Error::Internal);
+
auto initializationCallbacks = WTFMove(m_initializationCallbacks);
for (auto& callback : initializationCallbacks)
callback(Error::Internal);
@@ -289,6 +293,11 @@
void Engine::initialize(CompletionCallback&& callback)
{
+ if (m_clearTaskCounter || !m_pendingClearCallbacks.isEmpty()) {
+ m_pendingClearCallbacks.append(WTFMove(callback));
+ return;
+ }
+
if (m_salt) {
callback(WTF::nullopt);
return;
@@ -596,11 +605,24 @@
}
}
+CompletionHandler<void()> Engine::createClearTask(CompletionHandler<void()>&& completionHandler)
+{
+ ++m_clearTaskCounter;
+ return [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
+ completionHandler();
+ if (!--m_clearTaskCounter) {
+ auto callbacks = WTFMove(m_pendingClearCallbacks);
+ for (auto& callback : callbacks)
+ initialize(WTFMove(callback));
+ }
+ };
+}
+
void Engine::clearAllCaches(CompletionHandler<void()>&& completionHandler)
{
ASSERT(RunLoop::isMain());
- auto callbackAggregator = CallbackAggregator::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
+ auto callbackAggregator = CallbackAggregator::create([this, completionHandler = createClearTask(WTFMove(completionHandler))]() mutable {
if (!this->shouldPersist())
return completionHandler();
@@ -629,7 +651,7 @@
{
ASSERT(RunLoop::isMain());
- auto callbackAggregator = CallbackAggregator::create([this, protectedThis = makeRef(*this), origin, completionHandler = WTFMove(completionHandler)]() mutable {
+ auto callbackAggregator = CallbackAggregator::create([this, origin, completionHandler = createClearTask(WTFMove(completionHandler))]() mutable {
if (!this->shouldPersist())
return completionHandler();
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h (252411 => 252412)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2019-11-13 16:21:56 UTC (rev 252411)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2019-11-13 17:31:49 UTC (rev 252412)
@@ -132,6 +132,8 @@
using CacheCallback = Function<void(CacheOrError&&)>;
void readCache(uint64_t cacheIdentifier, CacheCallback&&);
+ CompletionHandler<void()> createClearTask(CompletionHandler<void()>&&);
+
Cache* cache(uint64_t cacheIdentifier);
PAL::SessionID m_sessionID;
@@ -146,6 +148,8 @@
HashMap<uint64_t, WebCore::DOMCacheEngine::CompletionCallback> m_pendingWriteCallbacks;
HashMap<uint64_t, CompletionHandler<void(const NetworkCache::Data&, int error)>> m_pendingReadCallbacks;
uint64_t m_pendingCallbacksCounter { 0 };
+ Vector<WebCore::DOMCacheEngine::CompletionCallback> m_pendingClearCallbacks;
+ uint64_t m_clearTaskCounter { 0 };
};
} // namespace CacheStorage
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp (252411 => 252412)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp 2019-11-13 16:21:56 UTC (rev 252411)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp 2019-11-13 17:31:49 UTC (rev 252412)
@@ -634,13 +634,6 @@
void Caches::clearMemoryRepresentation()
{
- if (!m_isInitialized) {
- ASSERT(!m_storage || !hasActiveCache() || !m_pendingInitializationCallbacks.isEmpty());
- // m_storage might not be null in case Caches is being initialized. This is fine as nullify it below is a memory optimization.
- m_caches.clear();
- return;
- }
-
makeDirty();
m_caches.clear();
m_isInitialized = false;