| Index: Source/core/html/parser/HTMLPreloadScanner.cpp
|
| diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
|
| index 44395718c6253b2dd08370460cb8b2d26e62e11a..34b0bdc34e1afbd13a80030ffb5efc5ccc85c79a 100644
|
| --- a/Source/core/html/parser/HTMLPreloadScanner.cpp
|
| +++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
|
| @@ -450,14 +450,14 @@ void TokenPreloadScanner::rewindTo(TokenPreloadScannerCheckpoint checkpointIndex
|
| m_checkpoints.clear();
|
| }
|
|
|
| -void TokenPreloadScanner::scan(const HTMLToken& token, const SegmentedString& source, PreloadRequestStream& requests)
|
| +void TokenPreloadScanner::scan(const HTMLToken& token, const SegmentedString& source, PreloadRequestStream& requests, String* preloadedReferrerPolicy)
|
| {
|
| - scanCommon(token, source, requests);
|
| + scanCommon(token, source, requests, preloadedReferrerPolicy);
|
| }
|
|
|
| -void TokenPreloadScanner::scan(const CompactHTMLToken& token, const SegmentedString& source, PreloadRequestStream& requests)
|
| +void TokenPreloadScanner::scan(const CompactHTMLToken& token, const SegmentedString& source, PreloadRequestStream& requests, String* preloadedReferrerPolicy)
|
| {
|
| - scanCommon(token, source, requests);
|
| + scanCommon(token, source, requests, preloadedReferrerPolicy);
|
| }
|
|
|
| static void handleMetaViewport(const String& attributeValue, CachedDocumentParameters* documentParameters)
|
| @@ -473,8 +473,8 @@ static void handleMetaViewport(const String& attributeValue, CachedDocumentParam
|
| cachedMediaValues->setViewportWidth(constraints.layoutSize.width());
|
| }
|
|
|
| -template<typename Token>
|
| -void TokenPreloadScanner::scanCommon(const Token& token, const SegmentedString& source, PreloadRequestStream& requests)
|
| +template <typename Token>
|
| +void TokenPreloadScanner::scanCommon(const Token& token, const SegmentedString& source, PreloadRequestStream& requests, String* preloadedReferrerPolicy)
|
| {
|
| if (!m_documentParameters->doHtmlPreloadScanning)
|
| return;
|
| @@ -554,6 +554,11 @@ void TokenPreloadScanner::scanCommon(const Token& token, const SegmentedString&
|
| handleMetaViewport(String(contentAttribute->value), m_documentParameters.get());
|
| return;
|
| }
|
| + if (nameAttribute && equalIgnoringCase(String(nameAttribute->value), "referrer")) {
|
| + const typename Token::Attribute* contentAttribute = token.getAttributeItem(contentAttr);
|
| + if (contentAttribute)
|
| + *preloadedReferrerPolicy = String(contentAttribute->value).isolatedCopy();
|
| + }
|
| }
|
|
|
| if (match(tagImpl, pictureTag)) {
|
| @@ -613,14 +618,18 @@ void HTMLPreloadScanner::scan(ResourcePreloader* preloader, const KURL& starting
|
| m_scanner.setPredictedBaseElementURL(startingBaseElementURL);
|
|
|
| PreloadRequestStream requests;
|
| + String preloadedReferrerPolicy;
|
|
|
| while (m_tokenizer->nextToken(m_source, m_token)) {
|
| if (m_token.type() == HTMLToken::StartTag)
|
| m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name(), Likely8Bit));
|
| - m_scanner.scan(m_token, m_source, requests);
|
| + m_scanner.scan(m_token, m_source, requests, &preloadedReferrerPolicy);
|
| m_token.clear();
|
| }
|
|
|
| + if (!preloadedReferrerPolicy.isEmpty())
|
| + preloader->preloadReferrerPolicy(preloadedReferrerPolicy);
|
| +
|
| preloader->takeAndPreload(requests);
|
| }
|
|
|
|
|