Title: [265471] branches/safari-610.1.25.10-branch/Source/WebCore
Revision
265471
Author
[email protected]
Date
2020-08-10 16:48:00 -0700 (Mon, 10 Aug 2020)

Log Message

Cherry-pick r265282. rdar://problem/66643985

    SWServerJobQueue::didResolveRegistrationPromise should not assume its registration key relates to an existing worker
    https://bugs.webkit.org/show_bug.cgi?id=215123
    <rdar://problem/65096786>

    Reviewed by Geoffrey Garen.

    We know that in some cases, the registration is null in SWServerJobQueue::didResolveRegistrationPromise.
    This might happen for instance in case a worker gets terminated, thus removing a job and the next job is clearing the registration.
    Also, SWServerJobQueue::didResolveRegistrationPromise is not checking that the job identifier is the same in SWServerJobQueue::install
    and SWServerJobQueue::didResolveRegistrationPromise while other code paths do.

    A future refactoring might allow to call SWServerJobQueue::didResolveRegistrationPromise code synchronously from SWServerJobQueue::install.
    In the meantime, let's add a null check and add release logging for that case.

    * workers/service/server/SWServerJobQueue.cpp:
    (WebCore::SWServerJobQueue::install):
    (WebCore::SWServerJobQueue::didResolveRegistrationPromise):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265282 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/ChangeLog (265470 => 265471)


--- branches/safari-610.1.25.10-branch/Source/WebCore/ChangeLog	2020-08-10 23:47:57 UTC (rev 265470)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/ChangeLog	2020-08-10 23:48:00 UTC (rev 265471)
@@ -1,5 +1,50 @@
 2020-08-10  Alan Coon  <[email protected]>
 
+        Cherry-pick r265282. rdar://problem/66643985
+
+    SWServerJobQueue::didResolveRegistrationPromise should not assume its registration key relates to an existing worker
+    https://bugs.webkit.org/show_bug.cgi?id=215123
+    <rdar://problem/65096786>
+    
+    Reviewed by Geoffrey Garen.
+    
+    We know that in some cases, the registration is null in SWServerJobQueue::didResolveRegistrationPromise.
+    This might happen for instance in case a worker gets terminated, thus removing a job and the next job is clearing the registration.
+    Also, SWServerJobQueue::didResolveRegistrationPromise is not checking that the job identifier is the same in SWServerJobQueue::install
+    and SWServerJobQueue::didResolveRegistrationPromise while other code paths do.
+    
+    A future refactoring might allow to call SWServerJobQueue::didResolveRegistrationPromise code synchronously from SWServerJobQueue::install.
+    In the meantime, let's add a null check and add release logging for that case.
+    
+    * workers/service/server/SWServerJobQueue.cpp:
+    (WebCore::SWServerJobQueue::install):
+    (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-05  Youenn Fablet  <[email protected]>
+
+            SWServerJobQueue::didResolveRegistrationPromise should not assume its registration key relates to an existing worker
+            https://bugs.webkit.org/show_bug.cgi?id=215123
+            <rdar://problem/65096786>
+
+            Reviewed by Geoffrey Garen.
+
+            We know that in some cases, the registration is null in SWServerJobQueue::didResolveRegistrationPromise.
+            This might happen for instance in case a worker gets terminated, thus removing a job and the next job is clearing the registration.
+            Also, SWServerJobQueue::didResolveRegistrationPromise is not checking that the job identifier is the same in SWServerJobQueue::install
+            and SWServerJobQueue::didResolveRegistrationPromise while other code paths do.
+
+            A future refactoring might allow to call SWServerJobQueue::didResolveRegistrationPromise code synchronously from SWServerJobQueue::install.
+            In the meantime, let's add a null check and add release logging for that case.
+
+            * workers/service/server/SWServerJobQueue.cpp:
+            (WebCore::SWServerJobQueue::install):
+            (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
+
+2020-08-10  Alan Coon  <[email protected]>
+
         Cherry-pick r265257. rdar://problem/66644029
 
     REGRESSION (r265019): ASSERTION FAILED: !m_impl || m_impl->wasConstructedOnMainThread() == isMainThread() under WebCore::PlaybackSessionInterfaceAVKit::invalidate()

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (265470 => 265471)


--- branches/safari-610.1.25.10-branch/Source/WebCore/workers/service/server/SWServerJobQueue.cpp	2020-08-10 23:47:57 UTC (rev 265470)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/workers/service/server/SWServerJobQueue.cpp	2020-08-10 23:48:00 UTC (rev 265471)
@@ -167,6 +167,8 @@
 
     // Invoke Resolve Job Promise with job and registration.
     m_server.resolveRegistrationJob(firstJob(), registration.data(), ShouldNotifyWhenResolved::Yes);
+
+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=215122. We do not need to wait for the registration promise to resolve to continue the install steps.
 }
 
 // https://w3c.github.io/ServiceWorker/#install (after resolving promise).
@@ -176,6 +178,11 @@
     ASSERT(registration);
     ASSERT(registration->installingWorker());
 
+    if (!registration || !registration->installingWorker()) {
+        RELEASE_LOG_ERROR(ServiceWorker, "%p - SWServerJobQueue::didResolveRegistrationPromise with null registration (%d) or null worker", this, !!registration);
+        return;
+    }
+
     RELEASE_LOG(ServiceWorker, "%p - SWServerJobQueue::didResolveRegistrationPromise: Registration ID: %llu. Now proceeding with install", this, registration->identifier().toUInt64());
 
     // Queue a task to fire an event named updatefound at all the ServiceWorkerRegistration objects
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to