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

Unified Diff: Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 1291613010: Implement referrerpolicy attribute for img elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix up no-referrer test Created 5 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/parser/HTMLPreloadScanner.cpp
diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
index 055e811b23f9025c037f00a0e4963680a3e4e484..b64bec1b625396823c94c3afa94a7013c521f586 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -593,7 +593,18 @@ void TokenPreloadScanner::scanCommon(const Token& token, const SegmentedString&
scanner.processAttributes(token.attributes());
if (m_inPicture)
scanner.handlePictureSourceURL(m_pictureData);
- OwnPtr<PreloadRequest> request = scanner.createPreloadRequest(m_predictedBaseElementURL, source, m_clientHintsPreferences, m_pictureData, m_documentParameters->referrerPolicy);
+
+ ReferrerPolicy referrerPolicy = m_documentParameters->referrerPolicy;
+ const typename Token::Attribute* referrerPolicyAttribute = token.getAttributeItem(referrerpolicyAttr);
+ if (referrerPolicyAttribute) {
+ String referrerPolicyValue(referrerPolicyAttribute->value);
+ ReferrerPolicy parsedReferrerPolicy;
+ if (SecurityPolicy::referrerPolicyFromString(referrerPolicyValue, &parsedReferrerPolicy)) {
+ referrerPolicy = parsedReferrerPolicy;
+ }
+ }
Yoav Weiss 2015/08/18 07:22:17 I don't think we should handle the referrer attrib
estark 2015/08/18 17:34:26 Hmm, I originally put it here because the spec def
+
+ OwnPtr<PreloadRequest> request = scanner.createPreloadRequest(m_predictedBaseElementURL, source, m_clientHintsPreferences, m_pictureData, referrerPolicy);
if (request)
requests.append(request.release());
return;

Powered by Google App Engine
This is Rietveld 408576698