Regression(r230567): Unable to log into twitter.com in private sessions
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Jun 2018 22:56:29 +0000 (22:56 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Jun 2018 22:56:29 +0000 (22:56 +0000)
commitbcbd776065f3ef25337fd4213d3b7d7f28c63f9b
tree1bbe8c55d84dd8bb7c07741e93b8c79cd1489461
parent4106efe11416a8311bab1dec46c47e4d4aa4afcb
Regression(r230567): Unable to log into twitter.com in private sessions
https://bugs.webkit.org/show_bug.cgi?id=186205
<rdar://problem/40670799>

Reviewed by Youenn Fablet.

We were using the same SWServer for all private sessions and the SWServer's sessionID would
be legacyPrivateSessionID(). As a result, the service worker's sessionID would be legacyPrivateSessionID()
Source/WebCore:

as well and would not match the sessionID of its client pages. This sessionID mismatch was
causing the breakage.

Instead of using the same SWServer of all private sessions, we now go back to using a SWServer
per private session. However, we now make sure that the SWServer gets destroyed whenever its
corresponding session gets destroyed.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::~SWServer):

Source/WebKit:

as well and would not match the sessionID of its client pages. This sessionID mismatch was
causing the breakage.

Instead of using the same SWServer of all private sessions, we now go back to using a SWServer
per private session. However, we now make sure that the SWServer gets destroyed whenever its
corresponding session gets destroyed.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::destroySession):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::from):
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::destroySession):
(WebKit::StorageProcess::swServerForSession):
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::~WebsiteDataStore):

(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::weakPtrFactory const):
Fix memory leak caused by a reference cycle between the WebsiteDataStore and its
WebResourceLoadStatisticsStore, by using WeakPtr to break the cycle. This was causing
us to leak WebsiteDataStore objects, which would prevent the destruction of sessions.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
Source/WebKit/StorageProcess/StorageProcess.cpp
Source/WebKit/StorageProcess/StorageProcess.h
Source/WebKit/StorageProcess/StorageProcess.messages.in
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h