Layout Test http/wpt/service-workers/header-filtering.https.html is a flaky failure
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 May 2018 19:53:38 +0000 (19:53 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 May 2018 19:53:38 +0000 (19:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184469
<rdar://problem/39428226>

Reviewed by Chris Dumez.

Ensure that the message posted for the loading of the initial iframe is actually received before doing further tests.

* http/wpt/service-workers/header-filtering.https.html:
* platform/mac-wk2/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/http/wpt/service-workers/header-filtering.https.html
LayoutTests/platform/mac-wk2/TestExpectations

index 666eb14..f3606b9 100644 (file)
@@ -1,3 +1,16 @@
+2018-05-02  Youenn Fablet  <youenn@apple.com>
+
+        Layout Test http/wpt/service-workers/header-filtering.https.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=184469
+        <rdar://problem/39428226>
+
+        Reviewed by Chris Dumez.
+
+        Ensure that the message posted for the loading of the initial iframe is actually received before doing further tests.
+
+        * http/wpt/service-workers/header-filtering.https.html:
+        * platform/mac-wk2/TestExpectations:
+
 2018-05-02  Chris Dumez  <cdumez@apple.com>
 
         document.open() event listener removal is not immediate
index e6b39bd..e844f90 100644 (file)
@@ -40,24 +40,31 @@ async function registerServiceWorker(scope)
     });
 }
 
+var processMessage;
 promise_test(async (test) => {
     registration = await registerServiceWorker(scope);
     registration.active.postMessage("ready?");
+
+    navigator.serviceWorker.onmessage = (event) => {
+        processMessage(event.data);
+    };
+
     return new Promise((resolve) => {
-        navigator.serviceWorker.onmessage = (event) => {
+        processMessage = (data) => {
             assert_equals(event.data, "ready");
-            navigator.serviceWorker.onmessage = undefined;
             resolve();
-        };
+        }
     });
 }, "Prepare tests: setup worker and register the client");
 
-var processMessage;
 promise_test(async (test) => {
+    const promise = new Promise((resolve) => {
+        processMessage = (data) => {
+            resolve(data);
+        };
+    });
     frame = await withFrame(scope + "/header-filtering-iframe.html");
-    navigator.serviceWorker.onmessage = (event) => {
-        processMessage(event.data);
-    };
+    await promise;
 }, "Prepare tests: Add a frame controlled by service worker");
 
 promise_test(async (test) => {
index 09a103e..635750e 100644 (file)
@@ -885,4 +885,3 @@ webkit.org/b/184245 http/tests/workers/service/service-worker-cache-api.https.ht
 
 webkit.org/b/177380 http/tests/cache-storage/cache-records-persistency.https.html [ Pass Failure ]
 
-webkit.org/b/184469 http/wpt/service-workers/header-filtering.https.html [ Pass Failure ]