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

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

Issue 2440803002: Filter out data urls in the preload scanner (Closed)
Patch Set: fix up 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
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..0ad899428c97e32a630591295ce521b5d248c7b9 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()) {
Yoav Weiss 2016/10/24 14:43:54 Why create a request for empty URLs?
Charlie Harrison 2016/10/24 14:49:31 I moved the isEmpty check to the PreloadRequest cl
Yoav Weiss 2016/10/24 15:00:32 OK, thanks!
- 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::create(
+ 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));
}

Powered by Google App Engine
This is Rietveld 408576698