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

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: move the check up 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d554c9b3c8c7a38a717b2e59b88254e44d473d9e 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -515,8 +515,10 @@ 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));
+ m_predictedBaseElementURL = url.isValid() ? url.copy() : KURL();
+ }
}
HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const KURL& documentURL, PassRefPtr<MediaValues> mediaValues)
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698