Title: [265282] trunk/Source/WebCore
- Revision
- 265282
- Author
- [email protected]
- Date
- 2020-08-05 01:33:35 -0700 (Wed, 05 Aug 2020)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (265281 => 265282)
--- trunk/Source/WebCore/ChangeLog 2020-08-05 08:22:02 UTC (rev 265281)
+++ trunk/Source/WebCore/ChangeLog 2020-08-05 08:33:35 UTC (rev 265282)
@@ -1,3 +1,23 @@
+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-05 Rob Buis <[email protected]>
Allow multiple calls to PerformanceObserver.observe with different types
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (265281 => 265282)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2020-08-05 08:22:02 UTC (rev 265281)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2020-08-05 08:33:35 UTC (rev 265282)
@@ -169,6 +169,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).
@@ -178,6 +180,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