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

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

Issue 2440803002: Filter out data urls in the preload scanner (Closed)
Patch Set: nits and test Created 4 years, 2 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/HTMLPreloadScanner.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/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..2e50772cdedf25c2204dfc4214c549fca0f173a7 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());
+ auto request = PreloadRequest::createIfNeeded(
+ 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));
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698