Title: [225483] trunk/Source/WebCore
- Revision
- 225483
- Author
- [email protected]
- Date
- 2017-12-04 10:55:07 -0800 (Mon, 04 Dec 2017)
Log Message
Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
https://bugs.webkit.org/show_bug.cgi?id=180359
Patch by Youenn Fablet <[email protected]> on 2017-12-04
Reviewed by Chris Dumez.
This algorithm is needed for implementation of claim.
As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::removeClientUsingRegistration):
(WebCore::SWServerRegistration::handleClientUnload):
* workers/service/server/SWServerRegistration.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (225482 => 225483)
--- trunk/Source/WebCore/ChangeLog 2017-12-04 18:37:00 UTC (rev 225482)
+++ trunk/Source/WebCore/ChangeLog 2017-12-04 18:55:07 UTC (rev 225483)
@@ -1,3 +1,18 @@
+2017-12-04 Youenn Fablet <[email protected]>
+
+ Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
+ https://bugs.webkit.org/show_bug.cgi?id=180359
+
+ Reviewed by Chris Dumez.
+
+ This algorithm is needed for implementation of claim.
+ As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
+
+ * workers/service/server/SWServerRegistration.cpp:
+ (WebCore::SWServerRegistration::removeClientUsingRegistration):
+ (WebCore::SWServerRegistration::handleClientUnload):
+ * workers/service/server/SWServerRegistration.h:
+
2017-12-04 Antti Koivisto <[email protected]>
Remove duplicates from selector filter hashes
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp (225482 => 225483)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-12-04 18:37:00 UTC (rev 225482)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-12-04 18:55:07 UTC (rev 225483)
@@ -161,6 +161,8 @@
if (iterator->value.isEmpty())
m_clientsUsingRegistration.remove(iterator);
+
+ handleClientUnload();
}
// https://w3c.github.io/ServiceWorker/#notify-controller-change
@@ -281,6 +283,16 @@
updateWorkerState(*activeWorker(), ServiceWorkerState::Activated);
}
+// https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
+void SWServerRegistration::handleClientUnload()
+{
+ if (hasClientsUsingRegistration())
+ return;
+ if (isUninstalling() && tryClear())
+ return;
+ tryActivate();
+}
+
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.h (225482 => 225483)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-12-04 18:37:00 UTC (rev 225482)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-12-04 18:55:07 UTC (rev 225483)
@@ -90,6 +90,7 @@
void forEachConnection(const WTF::Function<void(SWServer::Connection&)>&);
void activate();
+ void handleClientUnload();
ServiceWorkerRegistrationIdentifier m_identifier;
ServiceWorkerRegistrationKey m_registrationKey;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes