Bug 434340 - Firefox 3.0pre crashes with auto completion for tagged bookmark. p=ginn.chen@sun.com (Ginn Chen), r=Mardak, r=dietrich, b-ff3=beltzner, a1.9=beltzner
authoredward.lee@engineering.uiuc.edu
Mon, 26 May 2008 14:20:34 -0700
changeset 15047 7af4b1ad0b2e68284e797a59e8b733ad33286def
parent 15046 7075071ba297a5cad0b044cf11a1a99318e1fb5f
child 15048 1c22a42acf5e6a0d7e6acdc25878c662f7b7a028
push id475
push userjst@mozilla.com
push dateMon, 26 May 2008 22:11:04 +0000
reviewersMardak, dietrich
bugs434340
milestone1.9pre
Bug 434340 - Firefox 3.0pre crashes with auto completion for tagged bookmark. p=ginn.chen@sun.com (Ginn Chen), r=Mardak, r=dietrich, b-ff3=beltzner, a1.9=beltzner
toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
--- a/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
+++ b/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
@@ -97,17 +97,19 @@
 #define BOOK_TAG_SQL (\
   SQL_STR_FRAGMENT_GET_BOOK_TAG("parent", "b.parent", "!=", PR_TRUE) + \
   SQL_STR_FRAGMENT_GET_BOOK_TAG("bookmark", "b.title", "!=", PR_TRUE) + \
   SQL_STR_FRAGMENT_GET_BOOK_TAG("tags", "GROUP_CONCAT(t.title, ',')", "=", PR_FALSE))
 
 // This separator is used as an RTL-friendly way to split the title and tags.
 // It can also be used by an nsIAutoCompleteResult consumer to re-split the
 // "comment" back into the title and tag.
-NS_NAMED_LITERAL_STRING(kTitleTagsSeparator, " \u2013 ");
+// Use a Unichar array to avoid problems with 2-byte char strings: " \u2013 "
+const PRUnichar kTitleTagsSeparatorChars[] = { ' ', 0x2013, ' ', 0 };
+const nsString kTitleTagsSeparator = nsAutoString(kTitleTagsSeparatorChars);
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsNavHistoryAutoComplete Helper Functions
 
 /**
  * Returns true if the string starts with javascript:
  */
 inline PRBool