Regression(PSON) Google OAuth is broken in private sessions
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 00:08:42 +0000 (00:08 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 00:08:42 +0000 (00:08 +0000)
commit48261ce8716990c6a4a5f81e654745964039594a
treef1b15dbf033b35b11a2e50c3c179e4b290d9b4c3
parent52dbcf3fd38e5c968e5e276faa5a97218efd6d0d
Regression(PSON) Google OAuth is broken in private sessions
https://bugs.webkit.org/show_bug.cgi?id=192337
<rdar://problem/46353558>

Reviewed by Alex Christensen.

Source/WebKit:

In WebPageProxy::swapToWebProcess(), we would call removeWebPage() on the old WebProcessProxy and then
addExistingWebPage() on the new WebProcessProxy, as you would expect in case of process swap.

The issue is that WebProcessProxy::removeWebPage() calls WebProcessPool::pageEndUsingWebsiteDataStore()
which would cause the session to get destroyed assuming this was the last page using it. We would
therefore lose session cookies after a process-swap in private session.

To address the issue, a parameter to WebProcessPool::pageEndUsingWebsiteDataStore() and
WebProcessPool::pageBeginUsingWebsiteDataStore() to control if we want to tell the WebProcessPool
about the page beginning / ending its use of the session. In the case of a process-swap, we make
sure the process pool is not notified.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reattachToWebProcess):
(WebKit::WebPageProxy::swapToWebProcess):
(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::close):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createWebPage):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::removeWebPage):
* UIProcess/WebProcessProxy.h:

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/GetSessionCookie.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* TestWebKitAPI/Tests/WebKitCocoa/SetSessionCookie.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/GetSessionCookie.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/SetSessionCookie.html [new file with mode: 0644]