Title: [221428] trunk
Revision
221428
Author
commit-qu...@webkit.org
Date
2017-08-31 11:31:22 -0700 (Thu, 31 Aug 2017)

Log Message

Take into account removed caches in Caches::remove assertion
https://bugs.webkit.org/show_bug.cgi?id=176164

Patch by Youenn Fablet <you...@apple.com> on 2017-08-31
Reviewed by Alex Christensen.

Source/WebKit:

* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::remove):

LayoutTests:

* http/wpt/cache-storage/cache-remove-twice-expected.txt: Added.
* http/wpt/cache-storage/cache-remove-twice.html: Added.
* http/wpt/cache-storage/resources/cache-remove-twice-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (221427 => 221428)


--- trunk/LayoutTests/ChangeLog	2017-08-31 18:21:27 UTC (rev 221427)
+++ trunk/LayoutTests/ChangeLog	2017-08-31 18:31:22 UTC (rev 221428)
@@ -1,3 +1,14 @@
+2017-08-31  Youenn Fablet  <you...@apple.com>
+
+        Take into account removed caches in Caches::remove assertion
+        https://bugs.webkit.org/show_bug.cgi?id=176164
+
+        Reviewed by Alex Christensen.
+
+        * http/wpt/cache-storage/cache-remove-twice-expected.txt: Added.
+        * http/wpt/cache-storage/cache-remove-twice.html: Added.
+        * http/wpt/cache-storage/resources/cache-remove-twice-iframe.html: Added.
+
 2017-08-31  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Unreviewed, remove crash expectation for hopefully-fixed test

Added: trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice-expected.txt (0 => 221428)


--- trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice-expected.txt	2017-08-31 18:31:22 UTC (rev 221428)
@@ -0,0 +1,6 @@
+
+
+PASS Cleaning existing caches 
+PASS Removing the same cache from two different documents 
+PASS Cleaning added caches 
+

Added: trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice.html (0 => 221428)


--- trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice.html	2017-08-31 18:31:22 UTC (rev 221428)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Cache Storage: testing persistency</title>
+<script src=""
+<script src=""
+</head>
+<body>
+    <div id="check">
+    </div>
+    <script>
+    promise_test(test => {
+        return self.caches.keys().then(keys => {
+            var pending = [];
+            for (key of keys)
+                pending.push(self.caches.delete(keys[0]));
+            return Promise.all(pending);
+        });
+    }, "Cleaning existing caches");
+
+    promise_test(test => {
+        check.innerHTML = "<iframe id='cacheFrame' src=''></iframe>";
+        
+        var cacheName = "test-remove-twice";
+        return new Promise((resolve, reject) => {
+            window.addEventListener("message", test.step_func((event) => {
+                return Promise.all([self.caches.open(cacheName), cacheFrame.window.caches.open(cacheName) ]).then(() => {
+                    return Promise.all([self.caches.delete(cacheName), cacheFrame.window.caches.delete(cacheName)]);
+                }).then(resolve, reject);
+	    }));
+	});
+    }, "Removing the same cache from two different documents");
+
+   promise_test(test => {
+        return self.caches.keys().then(keys => {
+            var pending = [];
+            for (key of keys)
+                pending.push(self.caches.delete(keys[0]));
+            return Promise.all(pending);
+        });
+    }, "Cleaning added caches");
+    </script>
+</body>
+</html>
+

Added: trunk/LayoutTests/http/wpt/cache-storage/resources/cache-remove-twice-iframe.html (0 => 221428)


--- trunk/LayoutTests/http/wpt/cache-storage/resources/cache-remove-twice-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/cache-storage/resources/cache-remove-twice-iframe.html	2017-08-31 18:31:22 UTC (rev 221428)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <script>
+window.parent.postMessage("ready", "*");
+    </script>
+</body>
+</html>
+

Modified: trunk/Source/WebKit/ChangeLog (221427 => 221428)


--- trunk/Source/WebKit/ChangeLog	2017-08-31 18:21:27 UTC (rev 221427)
+++ trunk/Source/WebKit/ChangeLog	2017-08-31 18:31:22 UTC (rev 221428)
@@ -1,5 +1,15 @@
 2017-08-31  Youenn Fablet  <you...@apple.com>
 
+        Take into account removed caches in Caches::remove assertion
+        https://bugs.webkit.org/show_bug.cgi?id=176164
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
+        (WebKit::CacheStorage::Caches::remove):
+
+2017-08-31  Youenn Fablet  <you...@apple.com>
+
         Do not create a salt if the CacheStorage engine should not persist
         https://bugs.webkit.org/show_bug.cgi?id=176138
 

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp (221427 => 221428)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp	2017-08-31 18:21:27 UTC (rev 221427)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp	2017-08-31 18:31:22 UTC (rev 221428)
@@ -136,7 +136,11 @@
 
     auto position = m_caches.findMatching([&](const auto& item) { return item.identifier == identifier; });
 
-    ASSERT(position != notFound);
+    if (position == notFound) {
+        ASSERT(m_removedCaches.findMatching([&](const auto& item) { return item.identifier == identifier; }) != notFound);
+        callback(std::nullopt);
+        return;
+    }
 
     auto cache = WTFMove(m_caches[position]);
     m_caches.remove(position);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to