Index: tools/gn/escape.cc |
diff --git a/tools/gn/escape.cc b/tools/gn/escape.cc |
index f00bb63de2b59f310f3eab7f4d467c414371cb3b..e10e24a2b68c48f6a5c0454e33ecd036879320e0 100644 |
--- a/tools/gn/escape.cc |
+++ b/tools/gn/escape.cc |
@@ -42,6 +42,9 @@ void EscapeStringToString(const base::StringPiece& str, |
} |
} |
dest->push_back(' '); |
+ } else if (str[i] == '\'' && (options.mode & ESCAPE_JSON)) { |
+ dest->push_back('\\'); |
+ dest->push_back('\''); |
#if defined(OS_WIN) |
} else if (str[i] == '/' && options.convert_slashes) { |
// Convert slashes on Windows if requested. |
@@ -52,6 +55,9 @@ void EscapeStringToString(const base::StringPiece& str, |
dest->push_back('\\'); |
dest->push_back('\\'); |
#endif |
+ } else if (str[i] == '\\' && (options.mode & ESCAPE_JSON)) { |
+ dest->push_back('\\'); |
+ dest->push_back('\\'); |
} else { |
dest->push_back(str[i]); |
} |