Commit 1155516c authored by jochen@chromium.org's avatar jochen@chromium.org

Revert of Revert of Never send a referrer header if the referrer is not a web...

Revert of Revert of Never send a referrer header if the referrer is not a web url (https://codereview.chromium.org/133863003/)

Reason for revert:
Fixed the browser test meanwhile.

Original issue's description:
> Revert of Never send a referrer header if the referrer is not a web url (https://codereview.chromium.org/136583002/)
> 
> Reason for revert:
> This is the probable cause for the failing browser test CorrectReferrer. See:
> 
> http://build.chromium.org/p/chromium.webkit/builders/Linux%20Tests%20%28dbg%29/builds/1302/steps/browser_tests/logs/CorrectReferrer
> 
> http://build.chromium.org/p/chromium.webkit/builders/Mac10.8%20Tests/builds/5398/steps/browser_tests/logs/CorrectReferrer
> 
> http://build.chromium.org/p/chromium.webkit/builders/Win7%20Tests/builds/543/steps/browser_tests/logs/CorrectReferrer
> 
> Original issue's description:
> > Never send a referrer header if the referrer is not a web url
> > 
> > BUG=none
> > R=abarth@chromium.org
> > 
> > Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165085
> 
> TBR=abarth@chromium.org,jochen@chromium.org
> NOTREECHECKS=true
> NOTRY=true
> BUG=none
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165090

TBR=abarth@chromium.org,tdanderson@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=none

Review URL: https://codereview.chromium.org/130173004

git-svn-id: svn://svn.chromium.org/blink/trunk@165140 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a157286b
......@@ -884,6 +884,7 @@
'weborigin/KURLTest.cpp',
'weborigin/OriginAccessEntryTest.cpp',
'weborigin/SecurityOriginTest.cpp',
'weborigin/SecurityPolicyTest.cpp',
],
# NOTE: these are legacy unit tests, do not add more!
'platform_web_unittest_files': [
......
......@@ -70,6 +70,9 @@ String SecurityPolicy::generateReferrerHeader(ReferrerPolicy referrerPolicy, con
if (referrer.isEmpty())
return String();
if (!(protocolIs(referrer, "https") || protocolIs(referrer, "http")))
return String();
switch (referrerPolicy) {
case ReferrerPolicyNever:
return String();
......
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "platform/weborigin/SecurityPolicy.h"
#include "platform/weborigin/KURL.h"
#include <gtest/gtest.h>
using WebCore::KURL;
using WebCore::SecurityPolicy;
namespace {
TEST(SecurityPolicyTest, ReferrerIsAlwaysAWebURL)
{
EXPECT_TRUE(String() == SecurityPolicy::generateReferrerHeader(WebCore::ReferrerPolicyAlways, KURL(WebCore::ParsedURLString, "http://example.com/"), String::fromUTF8("chrome://somepage/")));
}
} // namespace
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment