Title: [229492] trunk/Source/WebCore
Revision
229492
Author
[email protected]
Date
2018-03-09 16:41:13 -0800 (Fri, 09 Mar 2018)

Log Message

Crash in ServiceWorkerContainer::ready
https://bugs.webkit.org/show_bug.cgi?id=183380

Reviewed by Chris Dumez.

Not using 'this' through lambdas.
Instead rely on the last lambda that is passed a ScriptExecutionContext& to get back 'this' which is a ServiceWorkerContainer.

Should be covered by imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html no longer crashing.
Although it should probably be LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html that should crash
since this is the main test using ready.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::ready):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229491 => 229492)


--- trunk/Source/WebCore/ChangeLog	2018-03-10 00:38:02 UTC (rev 229491)
+++ trunk/Source/WebCore/ChangeLog	2018-03-10 00:41:13 UTC (rev 229492)
@@ -1,5 +1,22 @@
 2018-03-09  Youenn Fablet  <[email protected]>
 
+        Crash in ServiceWorkerContainer::ready
+        https://bugs.webkit.org/show_bug.cgi?id=183380
+
+        Reviewed by Chris Dumez.
+
+        Not using 'this' through lambdas.
+        Instead rely on the last lambda that is passed a ScriptExecutionContext& to get back 'this' which is a ServiceWorkerContainer.
+
+        Should be covered by imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html no longer crashing.
+        Although it should probably be LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html that should crash
+        since this is the main test using ready.
+
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::ready):
+
+2018-03-09  Youenn Fablet  <[email protected]>
+
         RealtimeOutgoingAudioSource and RealtimeOutgoingVideoSource should be destroyed on the main thread
         https://bugs.webkit.org/show_bug.cgi?id=183483
         <rdar://problem/38214152>

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (229491 => 229492)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2018-03-10 00:38:02 UTC (rev 229491)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2018-03-10 00:41:13 UTC (rev 229492)
@@ -91,14 +91,17 @@
 
         auto& context = *scriptExecutionContext();
         auto contextIdentifier = this->contextIdentifier();
-        callOnMainThread([this, connection = makeRef(ensureSWClientConnection()), topOrigin = context.topOrigin().isolatedCopy(), clientURL = context.url().isolatedCopy(), contextIdentifier]() mutable {
-            connection->whenRegistrationReady(topOrigin, clientURL, [this, contextIdentifier](auto&& registrationData) {
-                ScriptExecutionContext::postTaskTo(contextIdentifier, [this, registrationData = crossThreadCopy(registrationData)](auto&) mutable {
-                    if (m_isStopped || !this->scriptExecutionContext()->sessionID().isValid())
+        callOnMainThread([connection = makeRef(ensureSWClientConnection()), topOrigin = context.topOrigin().isolatedCopy(), clientURL = context.url().isolatedCopy(), contextIdentifier]() mutable {
+            connection->whenRegistrationReady(topOrigin, clientURL, [contextIdentifier](auto&& registrationData) {
+                ScriptExecutionContext::postTaskTo(contextIdentifier, [registrationData = crossThreadCopy(registrationData)](auto& context) mutable {
+                    auto* serviceWorkerContainer = context.serviceWorkerContainer();
+                    if (!serviceWorkerContainer)
                         return;
+                    if (serviceWorkerContainer->m_isStopped || !context.sessionID().isValid())
+                        return;
 
-                    auto registration = ServiceWorkerRegistration::getOrCreate(*this->scriptExecutionContext(), *this, WTFMove(registrationData));
-                    m_readyPromise->resolve(WTFMove(registration));
+                    auto registration = ServiceWorkerRegistration::getOrCreate(context, *serviceWorkerContainer, WTFMove(registrationData));
+                    serviceWorkerContainer->m_readyPromise->resolve(WTFMove(registration));
                 });
             });
         });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to