Title: [228203] branches/safari-605-branch/Source/WebCore
Revision
228203
Author
jmarc...@apple.com
Date
2018-02-06 16:53:33 -0800 (Tue, 06 Feb 2018)

Log Message

Cherry-pick r228180. rdar://problem/37292935

Modified Paths

Diff

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (228202 => 228203)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-02-07 00:53:30 UTC (rev 228202)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-02-07 00:53:33 UTC (rev 228203)
@@ -1,5 +1,31 @@
 2018-02-06  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r228180. rdar://problem/37292935
+
+    2018-02-06  Chris Dumez  <cdu...@apple.com>
+
+            Service workers registrations are saved to disk before the install / activation succeeds
+            https://bugs.webkit.org/show_bug.cgi?id=182535
+            <rdar://problem/36591485>
+
+            Reviewed by Youenn Fablet.
+
+            Service workers registrations are saved to disk before the install / activation succeeds.
+            This means if the browser exits before the install / activation succeeds, we may restore
+            from disk a registration with an “active” worker which may have never been installed /
+            activated.
+
+            To address the issue, we now delay saving the registration to disk until after the service
+            worker has been activated.
+
+            No new tests, restoration from disk is covered by API tests that still pass.
+
+            * workers/service/server/SWServer.cpp:
+            (WebCore::SWServer::didFinishActivation):
+            (WebCore::SWServer::installContextData):
+
+2018-02-06  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r228149. rdar://problem/37264543
 
     2018-02-05  Filip Pizlo  <fpi...@apple.com>

Modified: branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.cpp (228202 => 228203)


--- branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.cpp	2018-02-07 00:53:30 UTC (rev 228202)
+++ branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.cpp	2018-02-07 00:53:33 UTC (rev 228203)
@@ -401,8 +401,12 @@
 {
     RELEASE_LOG(ServiceWorker, "%p - SWServer::didFinishActivation: Finished activation for service worker %llu", this, worker.identifier().toUInt64());
 
-    if (auto* registration = getRegistration(worker.registrationKey()))
-        registration->didFinishActivation(worker.identifier());
+    auto* registration = getRegistration(worker.registrationKey());
+    if (!registration)
+        return;
+
+    m_registrationStore.updateRegistration(worker.contextData());
+    registration->didFinishActivation(worker.identifier());
 }
 
 // https://w3c.github.io/ServiceWorker/#clients-getall
@@ -532,8 +536,6 @@
             return;
     }
 
-    m_registrationStore.updateRegistration(data);
-
     auto* connection = SWServerToContextConnection::globalServerToContextConnection();
     ASSERT(connection);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to