[ iOS Release ]: Layout Test http/tests/navigation/page-cache-domcache-pending-promis...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Nov 2019 13:28:57 +0000 (13:28 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Nov 2019 13:28:57 +0000 (13:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203373
<rdar://problem/56590038>

Reviewed by Youenn Fablet.

I am not able to reproduce the flakiness so this includes speculative fixes and better error handling so
that the test would hopefully fail with a message instead of timing out.

Speculative fixes:
1. If the promise is resolved before we've navigated away, retry it asynchronously.
2. If the promise is rejected before we've navigated away, retry it asynchronously instead of synchronously.
   I believe it is possible to prevent the navigation otherwise, in cases where the promise is rejected
   synchronously.

* http/tests/navigation/page-cache-domcache-pending-promise-expected.txt:
* http/tests/navigation/page-cache-domcache-pending-promise.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/cache-storage/page-cache-domcache-pending-promise-expected.txt [moved from LayoutTests/http/tests/navigation/page-cache-domcache-pending-promise-expected.txt with 83% similarity]
LayoutTests/http/tests/cache-storage/page-cache-domcache-pending-promise.html [new file with mode: 0644]
LayoutTests/http/tests/cache-storage/page-cache-domcachestorage-pending-promise-expected.txt [moved from LayoutTests/http/tests/navigation/page-cache-domcachestorage-pending-promise-expected.txt with 100% similarity]
LayoutTests/http/tests/cache-storage/page-cache-domcachestorage-pending-promise.html [moved from LayoutTests/http/tests/navigation/page-cache-domcachestorage-pending-promise.html with 92% similarity]
LayoutTests/http/tests/navigation/page-cache-domcache-pending-promise.html [deleted file]
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations

index 156794a..03d71a4 100644 (file)
@@ -1,3 +1,23 @@
+2019-11-22  Chris Dumez  <cdumez@apple.com>
+
+        [ iOS Release ]: Layout Test http/tests/navigation/page-cache-domcache-pending-promise.html is a Flaky Timeout
+        https://bugs.webkit.org/show_bug.cgi?id=203373
+        <rdar://problem/56590038>
+
+        Reviewed by Youenn Fablet.
+
+        I am not able to reproduce the flakiness so this includes speculative fixes and better error handling so
+        that the test would hopefully fail with a message instead of timing out.
+
+        Speculative fixes:
+        1. If the promise is resolved before we've navigated away, retry it asynchronously.
+        2. If the promise is rejected before we've navigated away, retry it asynchronously instead of synchronously.
+           I believe it is possible to prevent the navigation otherwise, in cases where the promise is rejected
+           synchronously.
+
+        * http/tests/navigation/page-cache-domcache-pending-promise-expected.txt:
+        * http/tests/navigation/page-cache-domcache-pending-promise.html:
+
 2019-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         File input should fire an 'input' event before the 'change' event
index 6fddfb5..7809de4 100644 (file)
@@ -473,7 +473,7 @@ imported/w3c/web-platform-tests/workers/modules/dedicated-worker-options-credent
 imported/w3c/web-platform-tests/workers/constructors/SharedWorker [ Skip ]
 imported/w3c/web-platform-tests/workers/SharedWorker_blobUrl.html [ Skip ]
 
-http/tests/navigation/page-cache-domcache-pending-promise.html [ DumpJSConsoleLogInStdErr ]
+http/tests/cache-storage/page-cache-domcache-pending-promise.html [ DumpJSConsoleLogInStdErr ]
 
 imported/w3c/web-platform-tests/beacon/beacon-basic-blob.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect.any.worker.html [ DumpJSConsoleLogInStdErr ]
@@ -7,8 +7,7 @@ pageshow - not from cache
 pagehide - entering cache
 pageshow - from cache
 PASS Page was restored from Page Cache
-PASS Cache.add() succeeded
-PASS !!restoredFromPageCache is true
+PASS Cache.add() succeeded after restoring from the cache
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/http/tests/cache-storage/page-cache-domcache-pending-promise.html b/LayoutTests/http/tests/cache-storage/page-cache-domcache-pending-promise.html
new file mode 100644 (file)
index 0000000..4467e28
--- /dev/null
@@ -0,0 +1,79 @@
+<!-- webkit-test-runner [ enableBackForwardCache=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+<script src="/js-test-resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description('Tests that a page with pending DOMCache activity goes into the page cache.');
+jsTestIsAsync = true;
+let restoredFromPageCache = false;
+
+window.addEventListener("pageshow", function(event) {
+    debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
+    if (event.persisted) {
+        testPassed("Page was restored from Page Cache");
+        restoredFromPageCache = true;
+        handle2 = setTimeout(() => {
+            testFailed("Page restored from cache but the promise was not resolved.");
+            finishJSTest();
+        }, 10000);
+    }
+});
+
+function tryCache()
+{
+    cache.add('../navigation/resources/blank.txt').then(() => {
+        if (!restoredFromPageCache) {
+            setTimeout(tryCache, 0);
+            return;
+        }
+        testPassed("Cache.add() succeeded after restoring from the cache");
+        clearTimeout(handle2);
+        finishJSTest();
+    }, (e) => {
+        setTimeout(tryCache, 0);
+    });
+}
+
+window.addEventListener("pagehide", function(event) {
+    debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
+    if (!event.persisted) {
+        testFailed("Page failed to enter the Page Cache");
+        finishJSTest();
+    }
+
+    tryCache();
+});
+
+async function clearExistingCache()
+{
+    try {
+        await self.caches.delete('page-cache-test');
+    } catch (e) {
+    }
+}
+
+onload = () => {
+    clearExistingCache();
+
+    setTimeout(() => {
+        handle1 = setTimeout(() => {
+            testFailed("Timed out while waiting for the cache to open");
+            finishJSTest();
+        }, 10000);
+        caches.open('page-cache-test').then((_cache) => {
+            clearTimeout(handle1);
+            cache = _cache;
+            testLink.click();
+        }, (e) => {
+            testFailed("Failed to open the cache: " + e);
+            finishJSTest();
+        });
+    }, 0);
+}
+</script>
+<a id="testLink" href="../navigation/resources/page-cache-helper.html" style="display: none">Link</a>
+</body>
+</html>
@@ -41,6 +41,6 @@ onload = () => {
     }, 0);
 }
 </script>
-<a id="testLink" href="resources/page-cache-helper.html" style="display: none">Link</a>
+<a id="testLink" href="../navigation/resources/page-cache-helper.html" style="display: none">Link</a>
 </body>
 </html>
diff --git a/LayoutTests/http/tests/navigation/page-cache-domcache-pending-promise.html b/LayoutTests/http/tests/navigation/page-cache-domcache-pending-promise.html
deleted file mode 100644 (file)
index 75ebfce..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<!-- webkit-test-runner [ enableBackForwardCache=true ] -->
-<!DOCTYPE html>
-<html>
-<head>
-<script src="/js-test-resources/js-test.js"></script>
-</head>
-<body>
-<script>
-description('Tests that a page with pending DOMCache activity goes into the page cache.');
-jsTestIsAsync = true;
-let restoredFromPageCache = false;
-
-window.addEventListener("pageshow", function(event) {
-    debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
-    if (event.persisted) {
-        testPassed("Page was restored from Page Cache");
-        restoredFromPageCache = true;
-    }
-});
-
-function tryCache()
-{
-    cache.add('resources/blank.txt').then(() => {
-        testPassed("Cache.add() succeeded");
-        shouldBeTrue("!!restoredFromPageCache");
-        finishJSTest();
-    }, (e) => {
-        tryCache();
-    });
-}
-
-window.addEventListener("pagehide", function(event) {
-    debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
-    if (!event.persisted) {
-        testFailed("Page failed to enter the Page Cache");
-        finishJSTest();
-    }
-
-    tryCache();
-});
-
-onload = () => {
-    setTimeout(() => {
-        caches.open('test').then((_cache) => {
-            cache = _cache;
-            testLink.click();
-        });
-    }, 0);
-}
-</script>
-<a id="testLink" href="resources/page-cache-helper.html" style="display: none">Link</a>
-</body>
-</html>
index f1fd7a0..db52cb4 100644 (file)
@@ -11,8 +11,6 @@ imported/w3c/web-platform-tests/server-timing/service_worker_idl.html [ Skip ]
 http/wpt/service-workers [ Skip ]
 http/wpt/cache-storage [ Skip ]
 http/tests/cache-storage [ Skip ]
-http/tests/navigation/page-cache-domcache-pending-promise.html [ Skip ]
-http/tests/navigation/page-cache-domcachestorage-pending-promise.html [ Skip ]
 imported/w3c/web-platform-tests/fetch/api/request/destination [ Skip ]
 imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy [ Skip ]
 
index efa6eb2..1d09764 100644 (file)
@@ -276,8 +276,6 @@ http/wpt/loading/redirect-headers.html [ Skip ]
 # No service worker implementation for WK1
 http/tests/appcache/main-resource-redirect-with-sw.html [ Skip ]
 http/tests/cache-storage [ Skip ]
-http/tests/navigation/page-cache-domcache-pending-promise.html [ Skip ]
-http/tests/navigation/page-cache-domcachestorage-pending-promise.html [ Skip ]
 http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html [ Skip ]
 http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html [ Skip ]
 http/wpt/cache-storage [ Skip ]
index 25ad3c5..a38fef1 100644 (file)
@@ -3804,8 +3804,6 @@ webkit.org/b/174801 fast/text/line-height-minimumFontSize.html [ Failure ]
 # No service worker implementation for WK1
 http/tests/appcache/main-resource-redirect-with-sw.html [ Skip ]
 http/tests/cache-storage [ Skip ]
-http/tests/navigation/page-cache-domcache-pending-promise.html [ Skip ]
-http/tests/navigation/page-cache-domcachestorage-pending-promise.html [ Skip ]
 http/tests/inspector/network/resource-response-service-worker.html [ Skip ]
 http/tests/workers/service [ Skip ]
 http/wpt/cache-storage [ Skip ]