Vary:Cookie validation doesn't work in private browsing
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Jun 2016 11:09:54 +0000 (11:09 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Jun 2016 11:09:54 +0000 (11:09 +0000)
commitb79e7cbfc82002cb33d56f1dd0566bb8e438d5d4
tree400fb99c7c58e1ea83d3391064129a37bbc9023b
parent63d90f8b3ec303395960b68f8ae64dea2f2843ea
Vary:Cookie validation doesn't work in private browsing
https://bugs.webkit.org/show_bug.cgi?id=158616
Source/WebCore:

rdar://problem/26755067

Reviewed by Darin Adler.

This wasn't implemented because there was no way to get NetworkStorageSession from
a SessionID on WebCore side.

The patch adds a simple WebCore level weak map that allows getting NetworkStorageSessions
from SessionID. This seemed like the cleanest way to do this without a big refactoring
around the currently WebKit2 level SessionTracker.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/network/CacheValidation.cpp:
(WebCore::headerValueForVary):

    Get NetworkStorageSession from SessionID for cookies

(WebCore::verifyVaryingRequestHeaders):
* platform/network/NetworkStorageSession.cpp: Added.

    Add platform independent .cpp for NetworkStorageSession.
    Implement a weak map for SessionID -> NetworkStorageSession.

(WebCore::sessionsMap):
(WebCore::NetworkStorageSession::NetworkStorageSession):
(WebCore::NetworkStorageSession::~NetworkStorageSession):
(WebCore::NetworkStorageSession::forSessionID):

    Get NetworkStorageSession for sessionID.

* platform/network/NetworkStorageSession.h:
(WebCore::NetworkStorageSession::sessionID):
(WebCore::NetworkStorageSession::credentialStorage):
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::NetworkStorageSession):

    Call to common constructor.

(WebCore::defaultNetworkStorageSession):
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::NetworkStorageSession):

    Call to common constructor.

(WebCore::defaultSession):
(WebCore::NetworkStorageSession::~NetworkStorageSession): Deleted.

LayoutTests:

Reviewed by Darin Adler.

* http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt:
* http/tests/cache/disk-cache/disk-cache-vary-cookie.html:

Exapand the existing test to cover memory cache and private browsing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/network/CacheValidation.cpp
Source/WebCore/platform/network/NetworkStorageSession.cpp [new file with mode: 0644]
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp