Bug 1426996 - Use fallible assign in NS_EscapeAndFilterURL r=kershaw a=gchang
authorValentin Gosu <valentin.gosu@gmail.com>
Tue, 26 Dec 2017 21:47:22 +0100
changeset 445513 5a76bef07139ef629e21c371a28030f04acf612d
parent 445512 24cedcea08dcca5344c52b758281aa5c8168a12b
child 445514 f926975917f9579d2097552f943aece7f6cb4dc8
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskershaw, gchang
bugs1426996
milestone58.0
Bug 1426996 - Use fallible assign in NS_EscapeAndFilterURL r=kershaw a=gchang MozReview-Commit-ID: EKVeQb3cboU
xpcom/io/nsEscape.cpp
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -441,17 +441,19 @@ NS_EscapeAndFilterURL(const nsACString& 
   bool appended = false;
   nsresult rv = T_EscapeURL(aStr.Data(), aStr.Length(), aFlags, aFilterMask, aResult, appended);
   if (NS_FAILED(rv)) {
     aResult.Truncate();
     return rv;
   }
 
   if (!appended) {
-    aResult = aStr;
+    if (!aResult.Assign(aStr, fallible)) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
   }
 
   return rv;
 }
 
 const nsAString&
 NS_EscapeURL(const nsAString& aStr, uint32_t aFlags, nsAString& aResult)
 {