API Test TestWebKitAPI.WebKit.DefaultQuota is very flaky on High Sierra
https://bugs.webkit.org/show_bug.cgi?id=202850
Reviewed by Alex Christensen.
Make sure the DOMCache / DOMCacheStorage objects stay alive while they have pending
promises to be resolved.
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::hasPendingActivity const):
* Modules/cache/DOMCache.h:
* Modules/cache/DOMCache.idl:
* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::hasPendingActivity const):
* Modules/cache/DOMCacheStorage.h:
* Modules/cache/DOMCacheStorage.idl:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251031 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 10e88c7..cf4d567 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,24 @@
2019-10-11 Chris Dumez <cdumez@apple.com>
+ API Test TestWebKitAPI.WebKit.DefaultQuota is very flaky on High Sierra
+ https://bugs.webkit.org/show_bug.cgi?id=202850
+
+ Reviewed by Alex Christensen.
+
+ Make sure the DOMCache / DOMCacheStorage objects stay alive while they have pending
+ promises to be resolved.
+
+ * Modules/cache/DOMCache.cpp:
+ (WebCore::DOMCache::hasPendingActivity const):
+ * Modules/cache/DOMCache.h:
+ * Modules/cache/DOMCache.idl:
+ * Modules/cache/DOMCacheStorage.cpp:
+ (WebCore::DOMCacheStorage::hasPendingActivity const):
+ * Modules/cache/DOMCacheStorage.h:
+ * Modules/cache/DOMCacheStorage.idl:
+
+2019-10-11 Chris Dumez <cdumez@apple.com>
+
Unreviewed, address post-landing feedback from Darin for r251019.
Added a new comment for clarity.
diff --git a/Source/WebCore/Modules/cache/DOMCache.cpp b/Source/WebCore/Modules/cache/DOMCache.cpp
index b6316d7..b9f935b 100644
--- a/Source/WebCore/Modules/cache/DOMCache.cpp
+++ b/Source/WebCore/Modules/cache/DOMCache.cpp
@@ -613,5 +613,10 @@
return true;
}
+bool DOMCache::hasPendingActivity() const
+{
+ return m_taskQueue->hasPendingTasks() || ActiveDOMObject::hasPendingActivity();
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/Modules/cache/DOMCache.h b/Source/WebCore/Modules/cache/DOMCache.h
index cf2061d..4dc03ca 100644
--- a/Source/WebCore/Modules/cache/DOMCache.h
+++ b/Source/WebCore/Modules/cache/DOMCache.h
@@ -63,6 +63,9 @@
CacheStorageConnection& connection() { return m_connection.get(); }
+ // ActiveDOMObject
+ bool hasPendingActivity() const final;
+
private:
DOMCache(ScriptExecutionContext&, String&& name, uint64_t identifier, Ref<CacheStorageConnection>&&);
diff --git a/Source/WebCore/Modules/cache/DOMCache.idl b/Source/WebCore/Modules/cache/DOMCache.idl
index 8340e95..6826b46 100644
--- a/Source/WebCore/Modules/cache/DOMCache.idl
+++ b/Source/WebCore/Modules/cache/DOMCache.idl
@@ -26,6 +26,7 @@
typedef (FetchRequest or USVString) RequestInfo;
[
+ ActiveDOMObject,
SecureContext,
Exposed=(Window,Worker),
EnabledAtRuntime=CacheAPI,
diff --git a/Source/WebCore/Modules/cache/DOMCacheStorage.cpp b/Source/WebCore/Modules/cache/DOMCacheStorage.cpp
index cc289a6..56f813f 100644
--- a/Source/WebCore/Modules/cache/DOMCacheStorage.cpp
+++ b/Source/WebCore/Modules/cache/DOMCacheStorage.cpp
@@ -293,4 +293,9 @@
return true;
}
+bool DOMCacheStorage::hasPendingActivity() const
+{
+ return m_taskQueue->hasPendingTasks() || ActiveDOMObject::hasPendingActivity();
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/Modules/cache/DOMCacheStorage.h b/Source/WebCore/Modules/cache/DOMCacheStorage.h
index 9b6d9b1..66e88b3 100644
--- a/Source/WebCore/Modules/cache/DOMCacheStorage.h
+++ b/Source/WebCore/Modules/cache/DOMCacheStorage.h
@@ -47,6 +47,9 @@
void remove(const String&, DOMPromiseDeferred<IDLBoolean>&&);
void keys(KeysPromise&&);
+ // ActiveDOMObject
+ bool hasPendingActivity() const final;
+
private:
DOMCacheStorage(ScriptExecutionContext&, Ref<CacheStorageConnection>&&);
diff --git a/Source/WebCore/Modules/cache/DOMCacheStorage.idl b/Source/WebCore/Modules/cache/DOMCacheStorage.idl
index 03196c5..55bdc26 100644
--- a/Source/WebCore/Modules/cache/DOMCacheStorage.idl
+++ b/Source/WebCore/Modules/cache/DOMCacheStorage.idl
@@ -26,6 +26,7 @@
typedef (FetchRequest or USVString) RequestInfo;
[
+ ActiveDOMObject,
SecureContext,
Exposed=(Window,Worker),
EnabledAtRuntime=CacheAPI,