We are only checking in service worker process right now but storage process is the one actually holding the state.
<rdar://problem/37004724>
Created attachment 332719 [details] Patch
Created attachment 332736 [details] Patch
Comment on attachment 332736 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332736&action=review > Source/WebCore/workers/service/server/SWServerRegistration.cpp:184 > + if (iterator != m_clientsUsingRegistration.end()) { When SWServerRegistration::unregisterServerConnection() is called, we remove that connectionIdentifier from m_clientsUsingRegistration. However, the clients for this connection might still be in SWServer::m_clientToControllingWorker & SWServer::m_clientsById I believe. Thus, the maps get out of sync. Youenn, do you agree with my analysis?
SWServerRegistration::unregisterServerConnection() is called in SWServer::Connection destructor. Before that, WebSWServerConnection destructor is calling SWServer::unregisterServiceWorkerClient() on all clients of the connection, thus taking care of SWServer::m_clientsById and SWServer::m_clientToControllingWorker. As a side note, we should probably move WebSWServerConnection::m_clientOrigins back to SWServer::Connection. That would allow doing the whole cleaning in SWServer::Connection destructor. Given the implementation of SWServer::unregisterServiceWorkerClient(), we may sometimes not call SWServerRegistration::removeClientUsingRegistration since we are trying to get back the registration from the service worker identifier and this only works if the service worker identifier is running or terminating. There is probably no guarantee that a terminating service worker is kept until all web processes refreshed their ids. WIP in bug 182313 is trying to fix that issue.