| Index: chrome/renderer/resources/extensions/schema_generated_bindings.js
|
| diff --git a/chrome/renderer/resources/extensions/schema_generated_bindings.js b/chrome/renderer/resources/extensions/schema_generated_bindings.js
|
| index 012e99f708c8ca014dea14bddce4ab39906fa015..c50d33bc6ca2fdd87e14347e09ac9e6feec31741 100644
|
| --- a/chrome/renderer/resources/extensions/schema_generated_bindings.js
|
| +++ b/chrome/renderer/resources/extensions/schema_generated_bindings.js
|
| @@ -472,11 +472,13 @@ var chrome = chrome || {};
|
|
|
| // Remove invalid characters from |text| so that it is suitable to use
|
| // for |AutocompleteMatch::contents|.
|
| - function sanitizeString(text) {
|
| + function sanitizeString(text, shouldTrim) {
|
| // NOTE: This logic mirrors |AutocompleteMatch::SanitizeString()|.
|
| // 0x2028 = line separator; 0x2029 = paragraph separator.
|
| var kRemoveChars = /(\r|\n|\t|\u2028|\u2029)/gm;
|
| - return text.trimLeft().replace(kRemoveChars, '');
|
| + if (shouldTrim)
|
| + text = text.trimLeft();
|
| + return text.replace(kRemoveChars, '');
|
| }
|
|
|
| // Parses the xml syntax supported by omnibox suggestion results. Returns an
|
| @@ -510,7 +512,8 @@ var chrome = chrome || {};
|
| for (var i = 0, child; child = node.childNodes[i]; i++) {
|
| // Append text nodes to our description.
|
| if (child.nodeType == Node.TEXT_NODE) {
|
| - result.description += sanitizeString(child.nodeValue);
|
| + var shouldTrim = result.description.length == 0;
|
| + result.description += sanitizeString(child.nodeValue, shouldTrim);
|
| continue;
|
| }
|
|
|
|
|