Title: [251681] tags/Safari-609.1.8
- Revision
- 251681
- Author
- [email protected]
- Date
- 2019-10-28 16:12:31 -0700 (Mon, 28 Oct 2019)
Log Message
Cherry-pick r251598. rdar://problem/56480245
WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
https://bugs.webkit.org/show_bug.cgi?id=203410
Reviewed by Chris Dumez.
Source/WebKit:
A SWServerRegistration is keeping a list of web processes that should be notified of change to its state.
Previously, WebProcesses were registering their interest to a SWServerRegistration on construction of a ServiceWorkerRegistration,
and unregistering their interest on destruction of a ServiceWorkerRegistration.
This does not work in case two ServiceWorkerRegistrations are created for the same SWServerRegistration in the same WebProcess.
In that case, when one of the two ServiceWorkerRegistration is destroyed, the WebProcess will no longer be notified of changes to the SWServerRegistration,
thus breaking the second ServiceWorkerRegistration behavior.
We introduce a map at WebProcess level to keep track of the number of ServiceWorkerRegistration created for a given SWServerRegistration.
Covered by re-enabled tests.
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
(WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::addServiceWorkerRegistration):
(WebKit::WebProcess::removeServiceWorkerRegistration):
* WebProcess/WebProcess.h:
LayoutTests:
* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: tags/Safari-609.1.8/LayoutTests/ChangeLog (251680 => 251681)
--- tags/Safari-609.1.8/LayoutTests/ChangeLog 2019-10-28 23:09:39 UTC (rev 251680)
+++ tags/Safari-609.1.8/LayoutTests/ChangeLog 2019-10-28 23:12:31 UTC (rev 251681)
@@ -1,3 +1,51 @@
+2019-10-28 Kocsen Chung <[email protected]>
+
+ Cherry-pick r251598. rdar://problem/56480245
+
+ WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=203410
+
+ Reviewed by Chris Dumez.
+
+ Source/WebKit:
+
+ A SWServerRegistration is keeping a list of web processes that should be notified of change to its state.
+ Previously, WebProcesses were registering their interest to a SWServerRegistration on construction of a ServiceWorkerRegistration,
+ and unregistering their interest on destruction of a ServiceWorkerRegistration.
+
+ This does not work in case two ServiceWorkerRegistrations are created for the same SWServerRegistration in the same WebProcess.
+ In that case, when one of the two ServiceWorkerRegistration is destroyed, the WebProcess will no longer be notified of changes to the SWServerRegistration,
+ thus breaking the second ServiceWorkerRegistration behavior.
+
+ We introduce a map at WebProcess level to keep track of the number of ServiceWorkerRegistration created for a given SWServerRegistration.
+
+ Covered by re-enabled tests.
+
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
+ (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::addServiceWorkerRegistration):
+ (WebKit::WebProcess::removeServiceWorkerRegistration):
+ * WebProcess/WebProcess.h:
+
+ LayoutTests:
+
+ * platform/ios-wk2/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-25 youenn fablet <[email protected]>
+
+ WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=203410
+
+ Reviewed by Chris Dumez.
+
+ * platform/ios-wk2/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+
2019-10-24 Kocsen Chung <[email protected]>
Cherry-pick r251567. rdar://problem/56560773
Modified: tags/Safari-609.1.8/Source/WebKit/ChangeLog (251680 => 251681)
--- tags/Safari-609.1.8/Source/WebKit/ChangeLog 2019-10-28 23:09:39 UTC (rev 251680)
+++ tags/Safari-609.1.8/Source/WebKit/ChangeLog 2019-10-28 23:12:31 UTC (rev 251681)
@@ -1,3 +1,68 @@
+2019-10-28 Kocsen Chung <[email protected]>
+
+ Cherry-pick r251598. rdar://problem/56480245
+
+ WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=203410
+
+ Reviewed by Chris Dumez.
+
+ Source/WebKit:
+
+ A SWServerRegistration is keeping a list of web processes that should be notified of change to its state.
+ Previously, WebProcesses were registering their interest to a SWServerRegistration on construction of a ServiceWorkerRegistration,
+ and unregistering their interest on destruction of a ServiceWorkerRegistration.
+
+ This does not work in case two ServiceWorkerRegistrations are created for the same SWServerRegistration in the same WebProcess.
+ In that case, when one of the two ServiceWorkerRegistration is destroyed, the WebProcess will no longer be notified of changes to the SWServerRegistration,
+ thus breaking the second ServiceWorkerRegistration behavior.
+
+ We introduce a map at WebProcess level to keep track of the number of ServiceWorkerRegistration created for a given SWServerRegistration.
+
+ Covered by re-enabled tests.
+
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
+ (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::addServiceWorkerRegistration):
+ (WebKit::WebProcess::removeServiceWorkerRegistration):
+ * WebProcess/WebProcess.h:
+
+ LayoutTests:
+
+ * platform/ios-wk2/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-25 youenn fablet <[email protected]>
+
+ WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=203410
+
+ Reviewed by Chris Dumez.
+
+ A SWServerRegistration is keeping a list of web processes that should be notified of change to its state.
+ Previously, WebProcesses were registering their interest to a SWServerRegistration on construction of a ServiceWorkerRegistration,
+ and unregistering their interest on destruction of a ServiceWorkerRegistration.
+
+ This does not work in case two ServiceWorkerRegistrations are created for the same SWServerRegistration in the same WebProcess.
+ In that case, when one of the two ServiceWorkerRegistration is destroyed, the WebProcess will no longer be notified of changes to the SWServerRegistration,
+ thus breaking the second ServiceWorkerRegistration behavior.
+
+ We introduce a map at WebProcess level to keep track of the number of ServiceWorkerRegistration created for a given SWServerRegistration.
+
+ Covered by re-enabled tests.
+
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
+ (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::addServiceWorkerRegistration):
+ (WebKit::WebProcess::removeServiceWorkerRegistration):
+ * WebProcess/WebProcess.h:
+
2019-10-24 Kocsen Chung <[email protected]>
Cherry-pick r251523. rdar://problem/56553939
Modified: tags/Safari-609.1.8/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (251680 => 251681)
--- tags/Safari-609.1.8/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2019-10-28 23:09:39 UTC (rev 251680)
+++ tags/Safari-609.1.8/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2019-10-28 23:12:31 UTC (rev 251681)
@@ -85,12 +85,15 @@
void WebSWClientConnection::addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier)
{
+ // FIXME: We should send the message to network process only if this is a new registration, once we correctly handle recovery upon network process crash.
+ WebProcess::singleton().addServiceWorkerRegistration(identifier);
send(Messages::WebSWServerConnection::AddServiceWorkerRegistrationInServer { identifier });
}
void WebSWClientConnection::removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier)
{
- send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer { identifier });
+ if (WebProcess::singleton().removeServiceWorkerRegistration(identifier))
+ send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer { identifier });
}
void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, MessageWithMessagePorts&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier)
Modified: tags/Safari-609.1.8/Source/WebKit/WebProcess/WebProcess.cpp (251680 => 251681)
--- tags/Safari-609.1.8/Source/WebKit/WebProcess/WebProcess.cpp 2019-10-28 23:09:39 UTC (rev 251680)
+++ tags/Safari-609.1.8/Source/WebKit/WebProcess/WebProcess.cpp 2019-10-28 23:12:31 UTC (rev 251681)
@@ -1806,6 +1806,16 @@
ServiceWorkerProvider::singleton().registerServiceWorkerClients();
}
+void WebProcess::addServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier identifier)
+{
+ m_swRegistrationCounts.add(identifier);
+}
+
+bool WebProcess::removeServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier identifier)
+{
+ ASSERT(m_swRegistrationCounts.contains(identifier));
+ return m_swRegistrationCounts.remove(identifier);
+}
#endif
#if PLATFORM(MAC)
Modified: tags/Safari-609.1.8/Source/WebKit/WebProcess/WebProcess.h (251680 => 251681)
--- tags/Safari-609.1.8/Source/WebKit/WebProcess/WebProcess.h 2019-10-28 23:09:39 UTC (rev 251680)
+++ tags/Safari-609.1.8/Source/WebKit/WebProcess/WebProcess.h 2019-10-28 23:12:31 UTC (rev 251681)
@@ -48,11 +48,12 @@
#if PLATFORM(MAC)
#include <WebCore/ScreenProperties.h>
#endif
+#include <WebCore/ServiceWorkerTypes.h>
#include <WebCore/Timer.h>
#include <pal/HysteresisActivity.h>
#include <pal/SessionID.h>
#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
+#include <wtf/HashCountedSet.h>
#include <wtf/HashSet.h>
#include <wtf/RefCounter.h>
#include <wtf/text/AtomString.h>
@@ -292,6 +293,11 @@
void messagesAvailableForPort(const WebCore::MessagePortIdentifier&);
+#if ENABLE(SERVICE_WORKER)
+ void addServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier);
+ bool removeServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier);
+#endif
+
private:
WebProcess();
~WebProcess();
@@ -579,6 +585,10 @@
float m_backlightLevel { 0 };
#endif
+#if ENABLE(SERVICE_WORKER)
+ HashCountedSet<WebCore::ServiceWorkerRegistrationIdentifier> m_swRegistrationCounts;
+#endif
+
HashMap<StorageAreaIdentifier, StorageAreaMap*> m_storageAreaMaps;
// Prewarmed WebProcesses do not have an associated sessionID yet, which is why this is an optional.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes