Title: [276649] trunk/Source/WebCore
Revision
276649
Author
[email protected]
Date
2021-04-27 11:39:02 -0700 (Tue, 27 Apr 2021)

Log Message

SWContextManager::postMessageToServiceWorker should check for valid service worker
https://bugs.webkit.org/show_bug.cgi?id=225096
<rdar://76718162>

Reviewed by Chris Dumez.

There is no guarantee that serviceWorker is not null.
For instance UIProcess may ask WebProcess to terminate all service workers in parallel to network process sending a message to it.

* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::postMessageToServiceWorker):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276648 => 276649)


--- trunk/Source/WebCore/ChangeLog	2021-04-27 18:13:56 UTC (rev 276648)
+++ trunk/Source/WebCore/ChangeLog	2021-04-27 18:39:02 UTC (rev 276649)
@@ -1,3 +1,17 @@
+2021-04-27  Youenn Fablet  <[email protected]>
+
+        SWContextManager::postMessageToServiceWorker should check for valid service worker
+        https://bugs.webkit.org/show_bug.cgi?id=225096
+        <rdar://76718162>
+
+        Reviewed by Chris Dumez.
+
+        There is no guarantee that serviceWorker is not null.
+        For instance UIProcess may ask WebProcess to terminate all service workers in parallel to network process sending a message to it.
+
+        * workers/service/context/SWContextManager.cpp:
+        (WebCore::SWContextManager::postMessageToServiceWorker):
+
 2021-04-27  Chris Dumez  <[email protected]>
 
         Ask LocalStorage database to free as much memory as possible on memory pressure

Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (276648 => 276649)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2021-04-27 18:13:56 UTC (rev 276648)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2021-04-27 18:39:02 UTC (rev 276649)
@@ -84,8 +84,8 @@
 void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&& message, ServiceWorkerOrClientData&& sourceData)
 {
     auto* serviceWorker = m_workerMap.get(destination);
-    ASSERT(serviceWorker);
-    ASSERT(!serviceWorker->isTerminatingOrTerminated());
+    if (!serviceWorker)
+        return;
 
     // FIXME: We should pass valid MessagePortChannels.
     serviceWorker->postMessageToServiceWorker(WTFMove(message), WTFMove(sourceData));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to