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

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

Issue 2148723002: Teach the preload scanner about the 'nonce' attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14ecba3af799fc287ea7b8df14d276a57f7e19fe..09e657f9aa8888892779c69314f82f0629107f1a 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -243,6 +243,7 @@ public:
ReferrerPolicy referrerPolicy = (m_referrerPolicy != ReferrerPolicyDefault) ? m_referrerPolicy : documentReferrerPolicy;
std::unique_ptr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type, referrerPolicy, resourceWidth, clientHintsPreferences, requestType);
request->setCrossOrigin(m_crossOrigin);
+ request->setNonce(m_nonce);
request->setCharset(charset());
request->setDefer(m_defer);
request->setIntegrityMetadata(m_integrityMetadata);
@@ -258,6 +259,8 @@ private:
setUrlToLoad(attributeValue, DisallowURLReplacement);
else if (match(attributeName, crossoriginAttr))
setCrossOrigin(attributeValue);
+ else if (match(attributeName, nonceAttr))
+ setNonce(attributeValue);
else if (match(attributeName, asyncAttr))
setDefer(FetchRequest::LazyLoad);
else if (match(attributeName, deferAttr))
@@ -315,6 +318,8 @@ private:
m_matched &= mediaAttributeMatches(*m_mediaValues, attributeValue);
} else if (match(attributeName, crossoriginAttr)) {
setCrossOrigin(attributeValue);
+ } else if (match(attributeName, nonceAttr)) {
+ setNonce(attributeValue);
} else if (match(attributeName, asAttr)) {
m_asAttributeValue = attributeValue;
} else if (match(attributeName, typeAttr)) {
@@ -448,6 +453,11 @@ private:
m_crossOrigin = crossOriginAttributeValue(corsSetting);
}
+ void setNonce(const String& nonce)
+ {
+ m_nonce = nonce;
+ }
+
void setDefer(FetchRequest::DeferOption defer)
{
m_defer = defer;
@@ -475,6 +485,7 @@ private:
bool m_sourceSizeSet;
FetchRequest::DeferOption m_defer;
CrossOriginAttributeValue m_crossOrigin;
+ String m_nonce;
Member<MediaValuesCached> m_mediaValues;
bool m_referrerPolicySet;
ReferrerPolicy m_referrerPolicy;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698