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

Unified Diff: net/base/net_util.cc

Issue 113606: Add JSON-specific escaping, which has different rules from JS escaping. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | « chrome/common/json_value_serializer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
===================================================================
--- net/base/net_util.cc (revision 16481)
+++ net/base/net_util.cc (working copy)
@@ -824,7 +824,7 @@
std::string result(header.data(), header.size());
result.append("<script>start(");
- string_escape::JavascriptDoubleQuote(title, true, &result);
+ string_escape::JsonDoubleQuote(title, true, &result);
result.append(");</script>\n");
return result;
@@ -836,17 +836,16 @@
const Time& modified) {
std::string result;
result.append("<script>addRow(");
- string_escape::JavascriptDoubleQuote(name, true, &result);
+ string_escape::JsonDoubleQuote(name, true, &result);
result.append(",");
- string_escape::JavascriptDoubleQuote(
- EscapePath(name), true, &result);
+ string_escape::JsonDoubleQuote(EscapePath(name), true, &result);
if (is_dir) {
result.append(",1,");
} else {
result.append(",0,");
}
- string_escape::JavascriptDoubleQuote(
+ string_escape::JsonDoubleQuote(
WideToUTF16Hack(FormatBytes(size, GetByteDisplayUnits(size), true)), true,
&result);
@@ -857,7 +856,7 @@
if (!modified.is_null()) {
modified_str = WideToUTF16Hack(base::TimeFormatShortDateAndTime(modified));
}
- string_escape::JavascriptDoubleQuote(modified_str, true, &result);
+ string_escape::JsonDoubleQuote(modified_str, true, &result);
result.append(");</script>\n");
« no previous file with comments | « chrome/common/json_value_serializer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698