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

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

Issue 1913983002: Use document referrer policy when preloading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test expectation Created 4 years, 8 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: third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
index 86c7f4a70cfac3dc02244d486bd34cd2cffe4400..1a41d791cdb6e9112881a7814d660fe3c668add6 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -484,6 +484,7 @@ TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<Cac
{
ASSERT(m_documentParameters.get());
ASSERT(m_mediaValues.get());
+ m_cssScanner.setReferrerPolicy(m_documentParameters->referrerPolicy);
}
TokenPreloadScanner::~TokenPreloadScanner()
@@ -541,8 +542,9 @@ static void handleMetaViewport(const String& attributeValue, const CachedDocumen
static void handleMetaReferrer(const String& attributeValue, CachedDocumentParameters* documentParameters, CSSPreloadScanner* cssScanner)
{
- if (attributeValue.isEmpty() || attributeValue.isNull() || !SecurityPolicy::referrerPolicyFromString(attributeValue, &documentParameters->referrerPolicy)) {
- documentParameters->referrerPolicy = ReferrerPolicyDefault;
+ ReferrerPolicy metaReferrerPolicy = ReferrerPolicyDefault;
+ if (!attributeValue.isEmpty() && !attributeValue.isNull() && SecurityPolicy::referrerPolicyFromString(attributeValue, &metaReferrerPolicy)) {
+ documentParameters->referrerPolicy = metaReferrerPolicy;
}
cssScanner->setReferrerPolicy(documentParameters->referrerPolicy);
}
@@ -799,7 +801,7 @@ CachedDocumentParameters::CachedDocumentParameters(Document* document)
defaultViewportMinWidth = document->viewportDefaultMinWidth();
viewportMetaZeroValuesQuirk = document->settings() && document->settings()->viewportMetaZeroValuesQuirk();
viewportMetaEnabled = document->settings() && document->settings()->viewportMetaEnabled();
- referrerPolicy = ReferrerPolicyDefault;
+ referrerPolicy = document->getReferrerPolicy();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698