Take referrer policy into account when clearing the referrer header
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Feb 2013 11:24:03 +0000 (11:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Feb 2013 11:24:03 +0000 (11:24 +0000)
commit0f0da94ecd682c639ab93c2af6db9c5e0c8c1cce
treeac4fd2aeb954937e1a854726a99c5d9f76e47581
parent17ae85d58a68dc3b8dad6e9ea2a8212e73b9ee71
Take referrer policy into account when clearing the referrer header
https://bugs.webkit.org/show_bug.cgi?id=86000

Patch by Marja Hölttä <marja@chromium.org> on 2013-02-06
Reviewed by Alexey Proskuryakov.

Source/WebCore:

The referrer should only be cleared when doing a https -> http redirect,
if the policy is "default". Otherwise the referrer should be left intact.

In order to do that, added a function for checking the policy in
NetworkingContext, and stored the NetworkingContext in ResourceHandle
(like some ports already did).

No new tests (unskipped old tests).

* loader/FrameNetworkingContext.h:
(WebCore::FrameNetworkingContext::shouldClearReferrerOnHTTPSToHTTPRedirect):
(FrameNetworkingContext):
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::BlobResourceHandle):
* platform/network/NetworkingContext.h:
(NetworkingContext):
* platform/network/ResourceHandle.cpp:
(WebCore::ResourceHandle::ResourceHandle):
(WebCore::ResourceHandle::create):
(WebCore::ResourceHandle::context):
(WebCore):
* platform/network/ResourceHandle.h:
(ResourceHandle):
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(ResourceHandleInternal):
* platform/network/blackberry/ResourceHandleBlackBerry.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::willSendRequest):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):
* platform/network/chromium/ResourceHandle.cpp:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(WebCore::ResourceHandle::ResourceHandle):
(WebCore::ResourceHandle::create):
(WebCore::ResourceHandle::context):
(WebCore):
(WebCore::ResourceHandle::start):
* platform/network/chromium/ResourceHandleInternal.h:
(WebCore):
(ResourceHandleInternal):
(WebCore::ResourceHandleInternal::context):
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):
(-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]):
* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyHandler::redirect):
* platform/network/qt/ResourceHandleQt.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::doRedirect):
(WebCore::ResourceHandle::start):
* platform/network/win/ResourceHandleWin.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):

Source/WebKit2:

The referrer should only be cleared when doing a https -> http redirect,
if the policy is "default". Otherwise the referrer should be left intact.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):
* NetworkProcess/SchedulableLoader.cpp:
(WebKit::SchedulableLoader::SchedulableLoader):
* NetworkProcess/SchedulableLoader.h:
(WebKit::SchedulableLoader::shouldClearReferrerOnHTTPSToHTTPRedirect):
(SchedulableLoader):
* NetworkProcess/SyncNetworkResourceLoader.cpp:
(WebKit::SyncNetworkResourceLoader::start):
* NetworkProcess/mac/RemoteNetworkingContext.h:
(WebKit::RemoteNetworkingContext::create):
(RemoteNetworkingContext):
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::shouldClearReferrerOnHTTPSToHTTPRedirect):
(WebKit):
(WebKit::RemoteNetworkingContext::RemoteNetworkingContext):
* Shared/Network/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
(WebKit::NetworkResourceLoadParameters::encode):
(WebKit::NetworkResourceLoadParameters::decode):
* Shared/Network/NetworkResourceLoadParameters.h:
(NetworkResourceLoadParameters):
(WebKit::NetworkResourceLoadParameters::shouldClearReferrerOnHTTPSToHTTPRedirect):
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleSubresourceLoad):
(WebKit::WebResourceLoadScheduler::schedulePluginStreamLoad):
(WebKit::WebResourceLoadScheduler::scheduleLoad):
* WebProcess/Network/WebResourceLoadScheduler.h:
(WebResourceLoadScheduler):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::loadResourceSynchronously):

LayoutTests:

Unskip http/tests/security/referrer-policy-redirect-link.html

Skipping the tests on wk2, because other referrer policy tests are
skipped, too ( https://bugs.webkit.org/show_bug.cgi?id=73913 ).

* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
* platform/wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameNetworkingContext.h
Source/WebCore/platform/network/BlobResourceHandle.cpp
Source/WebCore/platform/network/NetworkingContext.h
Source/WebCore/platform/network/ResourceHandle.cpp
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleInternal.h
Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
Source/WebCore/platform/network/chromium/ResourceHandle.cpp
Source/WebCore/platform/network/chromium/ResourceHandleInternal.h
Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
Source/WebCore/platform/network/qt/ResourceHandleQt.cpp
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
Source/WebCore/platform/network/win/ResourceHandleWin.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/SchedulableLoader.cpp
Source/WebKit2/NetworkProcess/SchedulableLoader.h
Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.h
Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp
Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h
Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp