diff --git a/toolkit/components/places/nsAndroidHistory.cpp b/toolkit/components/places/nsAndroidHistory.cpp
index 5faccde4541c..ee445269395f 100644
--- a/toolkit/components/places/nsAndroidHistory.cpp
+++ b/toolkit/components/places/nsAndroidHistory.cpp
@@ -72,7 +72,7 @@ nsAndroidHistory::RegisterVisitedCallback(nsIURI *aURI, Link *aContent)
nsCAutoString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) return rv;
- nsString uriString = NS_ConvertUTF8toUTF16(uri);
+ NS_ConvertUTF8toUTF16 uriString(uri);
nsTArray* list = mListeners.Get(uriString);
if (! list) {
@@ -98,7 +98,7 @@ nsAndroidHistory::UnregisterVisitedCallback(nsIURI *aURI, Link *aContent)
nsCAutoString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) return rv;
- nsString uriString = NS_ConvertUTF8toUTF16(uri);
+ NS_ConvertUTF8toUTF16 uriString(uri);
nsTArray* list = mListeners.Get(uriString);
if (! list)
@@ -126,7 +126,7 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, PRUint32 aFlag
nsCAutoString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) return rv;
- nsString uriString = NS_ConvertUTF8toUTF16(uri);
+ NS_ConvertUTF8toUTF16 uriString(uri);
bridge->MarkURIVisited(uriString);
}
return NS_OK;
diff --git a/toolkit/components/places/nsNavHistoryQuery.cpp b/toolkit/components/places/nsNavHistoryQuery.cpp
index 2578290df3e3..6ddd9a4c16cc 100644
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -791,7 +791,7 @@ nsNavHistory::TokensToQueries(const nsTArray& aTokens,
} else if (kvp.key.EqualsLiteral(QUERYKEY_TAG)) {
nsCAutoString unescaped(kvp.value);
NS_UnescapeURL(unescaped); // modifies input
- nsString tag = NS_ConvertUTF8toUTF16(unescaped);
+ NS_ConvertUTF8toUTF16 tag(unescaped);
if (!tags.Contains(tag)) {
NS_ENSURE_TRUE(tags.AppendElement(tag), NS_ERROR_OUT_OF_MEMORY);
}