Title: [225312] trunk/LayoutTests
Revision
225312
Author
cdu...@apple.com
Date
2017-11-29 18:31:43 -0800 (Wed, 29 Nov 2017)

Log Message

LayoutTest http/tests/workers/service/registration-clear-redundant-worker.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=179778

Reviewed by Youenn Fablet.

As per the specification [1], when clearing a registration, the registration's workers are first
marked as redundant *before* the registration's worker is set to null.

The test was waiting for the service worker's state to become redundant and then checking in a
setTimeout(0) that the registration's worker became null. However, a setTimeout(0) is racy here.
To address the issue, we now use setInterval() and wait until the worker becomes null.

[1] https://w3c.github.io/ServiceWorker/#clear-registration-algorithm

* TestExpectations:
* http/tests/workers/service/registration-clear-redundant-worker.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (225311 => 225312)


--- trunk/LayoutTests/ChangeLog	2017-11-30 02:23:44 UTC (rev 225311)
+++ trunk/LayoutTests/ChangeLog	2017-11-30 02:31:43 UTC (rev 225312)
@@ -1,3 +1,22 @@
+2017-11-29  Chris Dumez  <cdu...@apple.com>
+
+        LayoutTest http/tests/workers/service/registration-clear-redundant-worker.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=179778
+
+        Reviewed by Youenn Fablet.
+
+        As per the specification [1], when clearing a registration, the registration's workers are first
+        marked as redundant *before* the registration's worker is set to null.
+
+        The test was waiting for the service worker's state to become redundant and then checking in a
+        setTimeout(0) that the registration's worker became null. However, a setTimeout(0) is racy here.
+        To address the issue, we now use setInterval() and wait until the worker becomes null.
+
+        [1] https://w3c.github.io/ServiceWorker/#clear-registration-algorithm
+
+        * TestExpectations:
+        * http/tests/workers/service/registration-clear-redundant-worker.html:
+
 2017-11-29  Youenn Fablet  <you...@apple.com>
 
         ServiceWorkerClient objects should be reused if there is already one existing with the same identifier

Modified: trunk/LayoutTests/TestExpectations (225311 => 225312)


--- trunk/LayoutTests/TestExpectations	2017-11-30 02:23:44 UTC (rev 225311)
+++ trunk/LayoutTests/TestExpectations	2017-11-30 02:31:43 UTC (rev 225312)
@@ -183,7 +183,6 @@
 imported/w3c/web-platform-tests/service-workers/service-worker/websocket-in-service-worker.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/client-navigate.https.html [ Skip ]
 
-webkit.org/b/179778 http/tests/workers/service/registration-clear-redundant-worker.html [ Pass Failure ]
 http/tests/workers/service/service-worker-cache-api.https.html [ Pass Failure ]
 webkit.org/b/179137 imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.html [ Pass Failure ]

Modified: trunk/LayoutTests/http/tests/workers/service/registration-clear-redundant-worker.html (225311 => 225312)


--- trunk/LayoutTests/http/tests/workers/service/registration-clear-redundant-worker.html	2017-11-30 02:23:44 UTC (rev 225311)
+++ trunk/LayoutTests/http/tests/workers/service/registration-clear-redundant-worker.html	2017-11-30 02:31:43 UTC (rev 225312)
@@ -15,22 +15,23 @@
         }).then(function() {
             waitForState(worker, "redundant").then(function() {
                 log("PASS: Worker became redundant after unregistering");
-                setTimeout(function() {
-                    if (registration.installing)
-                        log("FAIL: registration.installing should be null");
-                    else
-                        log("PASS: registration.installing is null");
+                if (registration.installing)
+                    log("FAIL: registration.installing should be null");
+                else
+                    log("PASS: registration.installing is null");
 
-                    if (registration.waiting)
-                        log("FAIL: registration.waiting should be null");
-                    else
-                        log("PASS: registration.waiting is null");
+                if (registration.waiting)
+                    log("FAIL: registration.waiting should be null");
+                else
+                    log("PASS: registration.waiting is null");
 
+                handle = setInterval(function() {
                     if (registration.active)
-                        log("FAIL: registration.active should be null");
-                    else
-                        log("PASS: registration.active is null");
+                        return;
 
+                    log("PASS: registration.active is null");
+                    clearInterval(handle);
+
                     finishSWTest();
                 }, 0);
             });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to