API Test TestWebKitAPI.WebKit.DefaultQuota is very flaky on High Sierra
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Oct 2019 00:12:01 +0000 (00:12 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Oct 2019 00:12:01 +0000 (00:12 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@251031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/cache/DOMCache.cpp
Source/WebCore/Modules/cache/DOMCache.h
Source/WebCore/Modules/cache/DOMCache.idl
Source/WebCore/Modules/cache/DOMCacheStorage.cpp
Source/WebCore/Modules/cache/DOMCacheStorage.h
Source/WebCore/Modules/cache/DOMCacheStorage.idl

index 10e88c7..cf4d567 100644 (file)
@@ -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.
index b6316d7..b9f935b 100644 (file)
@@ -613,5 +613,10 @@ bool DOMCache::canSuspendForDocumentSuspension() const
     return true;
 }
 
+bool DOMCache::hasPendingActivity() const
+{
+    return m_taskQueue->hasPendingTasks() || ActiveDOMObject::hasPendingActivity();
+}
+
 
 } // namespace WebCore
index cf2061d..4dc03ca 100644 (file)
@@ -63,6 +63,9 @@ public:
 
     CacheStorageConnection& connection() { return m_connection.get(); }
 
+    // ActiveDOMObject
+    bool hasPendingActivity() const final;
+
 private:
     DOMCache(ScriptExecutionContext&, String&& name, uint64_t identifier, Ref<CacheStorageConnection>&&);
 
index 8340e95..6826b46 100644 (file)
@@ -26,6 +26,7 @@
 typedef (FetchRequest or USVString) RequestInfo;
 
 [
+    ActiveDOMObject,
     SecureContext,
     Exposed=(Window,Worker),
     EnabledAtRuntime=CacheAPI,
index cc289a6..56f813f 100644 (file)
@@ -293,4 +293,9 @@ bool DOMCacheStorage::canSuspendForDocumentSuspension() const
     return true;
 }
 
+bool DOMCacheStorage::hasPendingActivity() const
+{
+    return m_taskQueue->hasPendingTasks() || ActiveDOMObject::hasPendingActivity();
+}
+
 } // namespace WebCore
index 9b6d9b1..66e88b3 100644 (file)
@@ -47,6 +47,9 @@ public:
     void remove(const String&, DOMPromiseDeferred<IDLBoolean>&&);
     void keys(KeysPromise&&);
 
+    // ActiveDOMObject
+    bool hasPendingActivity() const final;
+
 private:
     DOMCacheStorage(ScriptExecutionContext&, Ref<CacheStorageConnection>&&);
 
index 03196c5..55bdc26 100644 (file)
@@ -26,6 +26,7 @@
 typedef (FetchRequest or USVString) RequestInfo;
 
 [
+    ActiveDOMObject,
     SecureContext,
     Exposed=(Window,Worker),
     EnabledAtRuntime=CacheAPI,