Title: [251434] trunk/Source/WebKit
Revision
251434
Author
[email protected]
Date
2019-10-22 08:55:33 -0700 (Tue, 22 Oct 2019)

Log Message

WebSWServerToContextConnection should not assert when failing loads at destruction time
https://bugs.webkit.org/show_bug.cgi?id=203243

Reviewed by Alex Christensen.

On WebSWServerToContextConnection destruction, we move the fetch task map and fail the tasks.
At destruction of the tasks, which happens synchronously, they will try to unregister themselves
and the assertion that the task is in the map will fail.
To fix that, add a specific contextClosed method that will clear the task connection weak pointer.

* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::contextClosed):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (251433 => 251434)


--- trunk/Source/WebKit/ChangeLog	2019-10-22 15:33:36 UTC (rev 251433)
+++ trunk/Source/WebKit/ChangeLog	2019-10-22 15:55:33 UTC (rev 251434)
@@ -1,5 +1,23 @@
 2019-10-22  youenn fablet  <[email protected]>
 
+        WebSWServerToContextConnection should not assert when failing loads at destruction time
+        https://bugs.webkit.org/show_bug.cgi?id=203243
+
+        Reviewed by Alex Christensen.
+
+        On WebSWServerToContextConnection destruction, we move the fetch task map and fail the tasks.
+        At destruction of the tasks, which happens synchronously, they will try to unregister themselves
+        and the assertion that the task is in the map will fail.
+        To fix that, add a specific contextClosed method that will clear the task connection weak pointer.
+
+        * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
+        (WebKit::ServiceWorkerFetchTask::contextClosed):
+        * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
+        * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
+        (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
+
+2019-10-22  youenn fablet  <[email protected]>
+
         ServiceWorkerFetchTask can use the NetworkConnectionToWebProcess sessionID
         https://bugs.webkit.org/show_bug.cgi?id=202208
 

Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp (251433 => 251434)


--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp	2019-10-22 15:33:36 UTC (rev 251433)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp	2019-10-22 15:55:33 UTC (rev 251434)
@@ -84,6 +84,12 @@
     startFetch();
 }
 
+void ServiceWorkerFetchTask::contextClosed()
+{
+    m_serviceWorkerConnection = nullptr;
+    didFail(ResourceError { errorDomainWebKitInternal, 0, { }, "Service Worker context closed"_s });
+}
+
 void ServiceWorkerFetchTask::startFetch()
 {
     auto& options = m_loader.parameters().options;

Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h (251433 => 251434)


--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h	2019-10-22 15:33:36 UTC (rev 251433)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h	2019-10-22 15:55:33 UTC (rev 251434)
@@ -75,6 +75,8 @@
     WebCore::ResourceRequest takeRequest() { return WTFMove(m_currentRequest); }
     bool wasHandled() const { return m_wasHandled; }
 
+    void contextClosed();
+
 private:
     void didReceiveRedirectResponse(WebCore::ResourceResponse&&);
     void didReceiveResponse(WebCore::ResourceResponse&&, bool needsContinueDidReceiveResponseMessage);

Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp (251433 => 251434)


--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp	2019-10-22 15:33:36 UTC (rev 251433)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp	2019-10-22 15:55:33 UTC (rev 251434)
@@ -55,7 +55,7 @@
 {
     auto fetches = WTFMove(m_ongoingFetches);
     for (auto& fetch : fetches.values())
-        fetch->fail(ResourceError { errorDomainWebKitInternal, 0, { }, "Service Worker context closed"_s });
+        fetch->contextClosed();
 
     if (m_server && m_server->contextConnectionForRegistrableDomain(registrableDomain()) == this)
         m_server->removeContextConnection(*this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to