Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2450343002: Apply document's referrer policy on client-initiated reload (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/resources/post-referrer-on-reload.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ResourceRequest request = 161 ResourceRequest request =
162 resourceRequestFromHistoryItem(m_currentItem.get(), cachePolicy); 162 resourceRequestFromHistoryItem(m_currentItem.get(), cachePolicy);
163 163
164 // ClientRedirectPolicy is an indication that this load was triggered by some 164 // ClientRedirectPolicy is an indication that this load was triggered by some
165 // direct interaction with the page. If this reload is not a client redirect, 165 // direct interaction with the page. If this reload is not a client redirect,
166 // we should reuse the referrer from the original load of the current 166 // we should reuse the referrer from the original load of the current
167 // document. If this reload is a client redirect (e.g., location.reload()), it 167 // document. If this reload is a client redirect (e.g., location.reload()), it
168 // was initiated by something in the current document and should therefore 168 // was initiated by something in the current document and should therefore
169 // show the current document's url as the referrer. 169 // show the current document's url as the referrer.
170 if (clientRedirectPolicy == ClientRedirectPolicy::ClientRedirect) { 170 if (clientRedirectPolicy == ClientRedirectPolicy::ClientRedirect) {
171 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer(), 171 request.setHTTPReferrer(SecurityPolicy::generateReferrer(
172 m_frame->document()->getReferrerPolicy())); 172 m_frame->document()->getReferrerPolicy(), m_frame->document()->url(),
173 m_frame->document()->outgoingReferrer()));
173 } 174 }
174 175
175 if (!overrideURL.isEmpty()) { 176 if (!overrideURL.isEmpty()) {
176 request.setURL(overrideURL); 177 request.setURL(overrideURL);
177 request.clearHTTPReferrer(); 178 request.clearHTTPReferrer();
178 } 179 }
179 request.setSkipServiceWorker(frameLoadType == 180 request.setSkipServiceWorker(frameLoadType ==
180 FrameLoadTypeReloadBypassingCache 181 FrameLoadTypeReloadBypassingCache
181 ? WebURLRequest::SkipServiceWorker::All 182 ? WebURLRequest::SkipServiceWorker::All
182 : WebURLRequest::SkipServiceWorker::None); 183 : WebURLRequest::SkipServiceWorker::None);
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 m_documentLoader ? m_documentLoader->url() : String()); 1937 m_documentLoader ? m_documentLoader->url() : String());
1937 return tracedValue; 1938 return tracedValue;
1938 } 1939 }
1939 1940
1940 inline void FrameLoader::takeObjectSnapshot() const { 1941 inline void FrameLoader::takeObjectSnapshot() const {
1941 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1942 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1942 toTracedValue()); 1943 toTracedValue());
1943 } 1944 }
1944 1945
1945 } // namespace blink 1946 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/resources/post-referrer-on-reload.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698