Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp |
| diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp |
| index 9c1d3c612f0796af666e3d709e173c53185144b5..c74f323e16ca1e62437ca69581e63a17bfc69781 100644 |
| --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp |
| +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp |
| @@ -231,13 +231,12 @@ static String parseCSSStringOrURL(const String& string) { |
| void CSSPreloadScanner::emitRule(const SegmentedString& source) { |
| if (equalIgnoringCase(m_rule, "import")) { |
| String url = parseCSSStringOrURL(m_ruleValue.toString()); |
| - if (!url.isEmpty()) { |
| - TextPosition position = |
| - TextPosition(source.currentLine(), source.currentColumn()); |
| - std::unique_ptr<PreloadRequest> request = |
| - PreloadRequest::create(FetchInitiatorTypeNames::css, position, url, |
| - *m_predictedBaseElementURL, |
| - Resource::CSSStyleSheet, m_referrerPolicy); |
| + TextPosition position = |
| + TextPosition(source.currentLine(), source.currentColumn()); |
| + std::unique_ptr<PreloadRequest> request = PreloadRequest::createIfNeeded( |
|
Yoav Weiss
2016/10/25 04:34:14
Nit: should this be "auto request"?
Charlie Harrison
2016/10/25 13:32:47
Sure. Done.
|
| + FetchInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, |
| + Resource::CSSStyleSheet, m_referrerPolicy); |
| + if (request) { |
| // FIXME: Should this be including the charset in the preload request? |
| m_requests->append(std::move(request)); |
| } |