Title: [253473] trunk/Source/WebCore
- Revision
- 253473
- Author
- [email protected]
- Date
- 2019-12-13 08:19:08 -0800 (Fri, 13 Dec 2019)
Log Message
Make DOMCacheStorage::retrieveCaches take a CompletionHandler
https://bugs.webkit.org/show_bug.cgi?id=205204
Patch by youenn fablet <[email protected]> on 2019-12-13
Reviewed by Chris Dumez.
Covered by existing tests.
* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::errorToException):
This will improve logging and will make sure we do not crash in debug in case of stopped error.
* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::retrieveCaches):
Use of a completion handler to make sure we answer the caller, even with an error case.
* Modules/cache/DOMCacheStorage.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253472 => 253473)
--- trunk/Source/WebCore/ChangeLog 2019-12-13 16:16:40 UTC (rev 253472)
+++ trunk/Source/WebCore/ChangeLog 2019-12-13 16:19:08 UTC (rev 253473)
@@ -1,3 +1,20 @@
+2019-12-13 youenn fablet <[email protected]>
+
+ Make DOMCacheStorage::retrieveCaches take a CompletionHandler
+ https://bugs.webkit.org/show_bug.cgi?id=205204
+
+ Reviewed by Chris Dumez.
+
+ Covered by existing tests.
+
+ * Modules/cache/DOMCacheEngine.cpp:
+ (WebCore::DOMCacheEngine::errorToException):
+ This will improve logging and will make sure we do not crash in debug in case of stopped error.
+ * Modules/cache/DOMCacheStorage.cpp:
+ (WebCore::DOMCacheStorage::retrieveCaches):
+ Use of a completion handler to make sure we answer the caller, even with an error case.
+ * Modules/cache/DOMCacheStorage.h:
+
2019-12-13 Carlos Garcia Campos <[email protected]>
[HarfBuzz] WebKitWebProcess crashes when displaying a KaTeX formula
Modified: trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp (253472 => 253473)
--- trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp 2019-12-13 16:16:40 UTC (rev 253472)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp 2019-12-13 16:19:08 UTC (rev 253473)
@@ -48,6 +48,8 @@
return Exception { QuotaExceededError, "Quota exceeded"_s };
case Error::Internal:
return Exception { TypeError, "Internal error"_s };
+ case Error::Stopped:
+ return Exception { TypeError, "Context is stopped"_s };
default:
ASSERT_NOT_REACHED();
return Exception { TypeError, "Connection stopped"_s };
Modified: trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp (253472 => 253473)
--- trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp 2019-12-13 16:16:40 UTC (rev 253472)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp 2019-12-13 16:19:08 UTC (rev 253473)
@@ -141,11 +141,13 @@
return DOMCache::create(*scriptExecutionContext(), WTFMove(info.name), info.identifier, m_connection.copyRef());
}
-void DOMCacheStorage::retrieveCaches(WTF::Function<void(Optional<Exception>&&)>&& callback)
+void DOMCacheStorage::retrieveCaches(CompletionHandler<void(Optional<Exception>&&)>&& callback)
{
auto origin = this->origin();
- if (!origin)
+ if (!origin) {
+ callback(convertToExceptionAndLog(scriptExecutionContext(), DOMCacheEngine::Error::Stopped));
return;
+ }
m_connection->retrieveCaches(*origin, m_updateCounter, [this, callback = WTFMove(callback), pendingActivity = makePendingActivity(*this)](CacheInfosOrError&& result) mutable {
if (!m_isStopped) {
Modified: trunk/Source/WebCore/Modules/cache/DOMCacheStorage.h (253472 => 253473)
--- trunk/Source/WebCore/Modules/cache/DOMCacheStorage.h 2019-12-13 16:16:40 UTC (rev 253472)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheStorage.h 2019-12-13 16:19:08 UTC (rev 253473)
@@ -55,7 +55,7 @@
void doOpen(const String& name, DOMPromiseDeferred<IDLInterface<DOMCache>>&&);
void doRemove(const String&, DOMPromiseDeferred<IDLBoolean>&&);
void doSequentialMatch(DOMCache::RequestInfo&&, CacheQueryOptions&&, Ref<DeferredPromise>&&);
- void retrieveCaches(WTF::Function<void(Optional<Exception>&&)>&&);
+ void retrieveCaches(CompletionHandler<void(Optional<Exception>&&)>&&);
Ref<DOMCache> findCacheOrCreate(DOMCacheEngine::CacheInfo&&);
Optional<ClientOrigin> origin() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes