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

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

Issue 1044133002: HTMLPreloadScanner should only use valid <base> urls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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: Source/core/html/parser/HTMLPreloadScanner.cpp
diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
index a98df60e30f99459ef336dd255f28deb2d1f4c31..83b1e5f221ba2c31b6c0f796338d9d8164abd431 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -515,8 +515,11 @@ template<typename Token>
void TokenPreloadScanner::updatePredictedBaseURL(const Token& token)
{
ASSERT(m_predictedBaseElementURL.isEmpty());
- if (const typename Token::Attribute* hrefAttribute = token.getAttributeItem(hrefAttr))
- m_predictedBaseElementURL = KURL(m_documentURL, stripLeadingAndTrailingHTMLSpaces(hrefAttribute->value)).copy();
+ if (const typename Token::Attribute* hrefAttribute = token.getAttributeItem(hrefAttr)) {
+ KURL url(m_documentURL, stripLeadingAndTrailingHTMLSpaces(hrefAttribute->value));
+ if (url.isValid())
+ m_predictedBaseElementURL = url.copy();
+ }
Yoav Weiss 2015/03/31 11:04:43 What does the parser do in case of an invalid base
kouhei (in TOK) 2015/03/31 11:15:38 Good point. Let me verify.
kouhei (in TOK) 2015/04/01 03:49:05 It seems that the parser would set empty url as th
}
HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const KURL& documentURL, PassRefPtr<MediaValues> mediaValues)
« LayoutTests/fast/parser/badurl-head-preloader-crash.html ('K') | « Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698