Title: [233554] trunk/LayoutTests
Revision
233554
Author
[email protected]
Date
2018-07-05 17:43:20 -0700 (Thu, 05 Jul 2018)

Log Message

Layout Test http/tests/workers/service/basic-messageport.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=182630

Reviewed by Alex Christensen.

Test is flaky due to a race between serviceWorkerClient.postMessage and MessagePort.postMessage.
Both are going through UIProcess but MessagePort events are grabbed asynchronously.
Fixed the test to not expect order between these two message exchange channels.

* http/tests/workers/service/basic-messageport-expected.txt:
* http/tests/workers/service/resources/basic-messageport.js:
(channel.port1.onmessage):
(then):
* platform/mac-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233553 => 233554)


--- trunk/LayoutTests/ChangeLog	2018-07-06 00:40:22 UTC (rev 233553)
+++ trunk/LayoutTests/ChangeLog	2018-07-06 00:43:20 UTC (rev 233554)
@@ -1,3 +1,20 @@
+2018-07-05  Youenn Fablet  <[email protected]>
+
+        Layout Test http/tests/workers/service/basic-messageport.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=182630
+
+        Reviewed by Alex Christensen.
+
+        Test is flaky due to a race between serviceWorkerClient.postMessage and MessagePort.postMessage.
+        Both are going through UIProcess but MessagePort events are grabbed asynchronously.
+        Fixed the test to not expect order between these two message exchange channels.
+
+        * http/tests/workers/service/basic-messageport-expected.txt:
+        * http/tests/workers/service/resources/basic-messageport.js:
+        (channel.port1.onmessage):
+        (then):
+        * platform/mac-wk2/TestExpectations:
+
 2018-07-05  David Fenton  <[email protected]>
 
         LayoutTest imported/w3c/web-platform-tests/IndexedDB/interfaces.any.worker.html is flaky.

Modified: trunk/LayoutTests/http/tests/workers/service/basic-messageport-expected.txt (233553 => 233554)


--- trunk/LayoutTests/http/tests/workers/service/basic-messageport-expected.txt	2018-07-06 00:40:22 UTC (rev 233553)
+++ trunk/LayoutTests/http/tests/workers/service/basic-messageport-expected.txt	2018-07-06 00:43:20 UTC (rev 233554)
@@ -1,4 +1,4 @@
+Message received from MessagePort: MessagePort echo: Message to a port!
 Message received from ServiceWorker: PASS: Got the MessagePort
 Message received from ServiceWorker: messageport thing received....
-Message received from MessagePort: MessagePort echo: Message to a port!
 

Modified: trunk/LayoutTests/http/tests/workers/service/resources/basic-messageport.js (233553 => 233554)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-messageport.js	2018-07-06 00:40:22 UTC (rev 233553)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-messageport.js	2018-07-06 00:43:20 UTC (rev 233554)
@@ -1,19 +1,31 @@
+var messages = [];
+
+function doLog(message)
+{
+    messages.push(message)
+    if (messages.length === 3) {
+        messages.sort();
+        for (let message of messages)
+            log(message);
+        finishSWTest();
+    }
+}
+
 navigator.serviceWorker.addEventListener("message", function(event) {
-    log("Message received from ServiceWorker: " + event.data);
+    doLog("Message received from ServiceWorker: " + event.data);
 });
 
 var channel = new MessageChannel;
 channel.port1._onmessage_ = function(event) {
-	log("Message received from MessagePort: " + event.data);
-	finishSWTest();
+    doLog("Message received from MessagePort: " + event.data);
 }
 
 navigator.serviceWorker.register("resources/messageport-echo-worker.js", { }).then(function(registration) {
-	try {
-    	registration.installing.postMessage("Here is your port", [channel.port2]);
+    try {
+        registration.installing.postMessage("Here is your port", [channel.port2]);
         channel.port1.postMessage("Message to a port!");
-	} catch(e) {
-		log("Exception: " + e);
-		finishSWTest();
-	}
+    } catch(e) {
+        doLog("Exception: " + e);
+        finishSWTest();
+    }
 });

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (233553 => 233554)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-07-06 00:40:22 UTC (rev 233553)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-07-06 00:43:20 UTC (rev 233554)
@@ -862,8 +862,6 @@
 
 webkit.org/b/179352 imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html [ Pass Failure Slow ]
 
-webkit.org/b/182630 http/tests/workers/service/basic-messageport.html [ Pass Failure ]
-
 webkit.org/b/182849 imported/w3c/web-platform-tests/XMLHttpRequest/event-upload-progress-crossorigin.htm [ Pass Failure ]
 
 webkit.org/b/183164 fast/dom/Window/window-focus-self.html [ Pass Failure ]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to