Title: [257929] trunk
Revision
257929
Author
you...@apple.com
Date
2020-03-05 10:42:04 -0800 (Thu, 05 Mar 2020)

Log Message

In case an activating service worker is terminated, it should go to activated state
https://bugs.webkit.org/show_bug.cgi?id=208440
<rdar://problem/59742332>

Reviewed by Chris Dumez.

Source/WebCore:

Covered by updated test.

* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::setState):
As per spec, if an activated service worker is terminated or its activate event is timing out,
we should move it to activate state.

LayoutTests:

* http/wpt/service-workers/service-worker-spinning-activate.https.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (257928 => 257929)


--- trunk/LayoutTests/ChangeLog	2020-03-05 18:38:30 UTC (rev 257928)
+++ trunk/LayoutTests/ChangeLog	2020-03-05 18:42:04 UTC (rev 257929)
@@ -1,3 +1,13 @@
+2020-03-05  youenn fablet  <you...@apple.com>
+
+        In case an activating service worker is terminated, it should go to activated state
+        https://bugs.webkit.org/show_bug.cgi?id=208440
+        <rdar://problem/59742332>
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/service-workers/service-worker-spinning-activate.https.html:
+
 2020-03-05  Zalan Bujtas  <za...@apple.com>
 
         [LFC][Integration] Reset position style on line breaks.

Modified: trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-activate.https.html (257928 => 257929)


--- trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-activate.https.html	2020-03-05 18:38:30 UTC (rev 257928)
+++ trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-activate.https.html	2020-03-05 18:42:04 UTC (rev 257929)
@@ -28,7 +28,9 @@
 
     await Promise.all(promises);
 
-    return waitForServiceWorkerNoLongerRunning(worker);
+    await waitForServiceWorkerNoLongerRunning(worker);
+
+    await waitForState(worker, "activated");
 }, "Spin in activate");
 
 promise_test(async (test) => {

Modified: trunk/Source/WebCore/ChangeLog (257928 => 257929)


--- trunk/Source/WebCore/ChangeLog	2020-03-05 18:38:30 UTC (rev 257928)
+++ trunk/Source/WebCore/ChangeLog	2020-03-05 18:42:04 UTC (rev 257929)
@@ -1,3 +1,18 @@
+2020-03-05  youenn fablet  <you...@apple.com>
+
+        In case an activating service worker is terminated, it should go to activated state
+        https://bugs.webkit.org/show_bug.cgi?id=208440
+        <rdar://problem/59742332>
+
+        Reviewed by Chris Dumez.
+
+        Covered by updated test.
+
+        * workers/service/server/SWServerWorker.cpp:
+        (WebCore::SWServerWorker::setState):
+        As per spec, if an activated service worker is terminated or its activate event is timing out,
+        we should move it to activate state.
+
 2020-03-05  Zalan Bujtas  <za...@apple.com>
 
         [LFC][Integration] Reset position style on line breaks.

Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp (257928 => 257929)


--- trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp	2020-03-05 18:38:30 UTC (rev 257928)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp	2020-03-05 18:42:04 UTC (rev 257929)
@@ -249,8 +249,13 @@
         m_shouldSkipHandleFetch = false;
         break;
     case State::Terminating:
+        callWhenActivatedHandler(false);
+        break;
     case State::NotRunning:
         callWhenActivatedHandler(false);
+        // As per https://w3c.github.io/ServiceWorker/#activate, a worker goes to activated even if activating fails.
+        if (m_data.state == ServiceWorkerState::Activating)
+            didFinishActivation();
         break;
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to