editing/async-clipboard/clipboard-item-basic.html is a flaky failure on macOS and iOS
https://bugs.webkit.org/show_bug.cgi?id=203015

Reviewed by Tim Horton.

This test, for the most part, finishes and dumps its final output before a couple of (intentionally) rejected
promises finish and log their uncaught rejections to the console. In the case where we lose this race and the
console messages happen earlier, we end up with a text diff failure.

Avoid this issue by making sure that we catch these promise rejections.

* editing/async-clipboard/clipboard-item-basic.html:

Also give this test a tiny bit more variety, by making one of the promises reject immediately, while the other
still waits for a short delay (50 ms).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 60c6160..1e93c15 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2019-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        editing/async-clipboard/clipboard-item-basic.html is a flaky failure on macOS and iOS
+        https://bugs.webkit.org/show_bug.cgi?id=203015
+
+        Reviewed by Tim Horton.
+
+        This test, for the most part, finishes and dumps its final output before a couple of (intentionally) rejected
+        promises finish and log their uncaught rejections to the console. In the case where we lose this race and the
+        console messages happen earlier, we end up with a text diff failure.
+
+        Avoid this issue by making sure that we catch these promise rejections.
+
+        * editing/async-clipboard/clipboard-item-basic.html:
+
+        Also give this test a tiny bit more variety, by making one of the promises reject immediately, while the other
+        still waits for a short delay (50 ms).
+
 2019-10-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
 
         Import apng testcases from WPT.
diff --git a/LayoutTests/editing/async-clipboard/clipboard-item-basic.html b/LayoutTests/editing/async-clipboard/clipboard-item-basic.html
index 1a3b62d..de6cdf4 100644
--- a/LayoutTests/editing/async-clipboard/clipboard-item-basic.html
+++ b/LayoutTests/editing/async-clipboard/clipboard-item-basic.html
@@ -143,8 +143,10 @@
             await (async function() {
                 item = tryToCreateClipboardItem({
                     "text/plain" : Promise.resolve("璎濊瑵"),
-                    "text/html" : new Promise((_, reject) => setTimeout(() => reject(imageBlob()), 50)),
-                    "image/png" : new Promise((_, reject) => setTimeout(() => reject(imageBlob()), 50)),
+                    "text/html" : new Promise((_, reject) => {
+                        setTimeout(reject, 50);
+                    }).catch(() => { }),
+                    "image/png" : Promise.reject(imageBlob()).catch(() => { }),
                     "馃馃馃" : Promise.resolve("诪拽讜专 讛砖诐 注讘专讬转"),
                     "诪拽讜专 讛砖诐 注讘专讬转" : Promise.resolve("馃馃馃")
                 });