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

Unified Diff: third_party/WebKit/Source/web/WebPageSerializerImpl.cpp

Issue 1398453005: Make WebPageSerializerImpl to escape URL attribute values in result. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-10-13T17:56:56 Rebase Created 5 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/web/tests/WebPageSerializerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp b/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
index 34bc016e83ca2780aa3ff3e6153ee8224a56a56b..1f7ba05a7e78c6e6c763f579126cc082c116d11e 100644
--- a/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
@@ -287,6 +287,9 @@ void WebPageSerializerImpl::encodeAndFlushBuffer(
status);
}
+// TODO(yosin): We should utilize |MarkupFormatter| here to share code,
+// especially escaping attribute values, done by |WebEntities| |m_htmlEntities|
+// and |m_xmlEntities|.
void WebPageSerializerImpl::openTagToString(Element* element,
SerializeDomParam* param)
{
@@ -316,7 +319,7 @@ void WebPageSerializerImpl::openTagToString(Element* element,
if (element->hasLegalLinkAttribute(attrName)) {
// For links start with "javascript:", we do not change it.
if (attrValue.startsWith("javascript:", TextCaseInsensitive)) {
- result.append(attrValue);
+ result.append(m_htmlEntities.convertEntitiesInString(attrValue));
} else {
// Get the absolute link
WebLocalFrameImpl* subFrame = WebLocalFrameImpl::fromFrameOwnerElement(element);
@@ -329,9 +332,9 @@ void WebPageSerializerImpl::openTagToString(Element* element,
result.append(param->directoryName);
result.append('/');
}
- result.append(m_localLinks.get(completeURL));
+ result.append(m_htmlEntities.convertEntitiesInString(m_localLinks.get(completeURL)));
} else {
- result.append(completeURL);
+ result.append(m_htmlEntities.convertEntitiesInString(completeURL));
}
}
} else {
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698