Bug 1305422 - part 16 - don't call size_backward in nsExceptionHandler.cpp; r=ted.mielczarek
authorNathan Froyd <froydnj@mozilla.com>
Thu, 29 Sep 2016 22:33:57 -0400
changeset 315887 8ad96d4c9d427e135e51b9dd7af31a9d99782e2c
parent 315886 daf738c4a41117ef270fc56dd1ec10121b596802
child 315888 f933f6215b9d67ab84255642d8ab2cb208f051c1
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1305422
milestone52.0a1
Bug 1305422 - part 16 - don't call size_backward in nsExceptionHandler.cpp; r=ted.mielczarek
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -2058,27 +2058,29 @@ nsresult UnsetExceptionHandler()
   dumpSafetyLock = nullptr;
 
   return NS_OK;
 }
 
 static void ReplaceChar(nsCString& str, const nsACString& character,
                         const nsACString& replacement)
 {
-  nsCString::const_iterator start, end;
-
-  str.BeginReading(start);
+  nsCString::const_iterator iter, end;
+
+  str.BeginReading(iter);
   str.EndReading(end);
 
-  while (FindInReadable(character, start, end)) {
-    int32_t pos = end.size_backward();
+  while (FindInReadable(character, iter, end)) {
+    nsCString::const_iterator start;
+    str.BeginReading(start);
+    int32_t pos = end - start;
     str.Replace(pos - 1, 1, replacement);
 
-    str.BeginReading(start);
-    start.advance(pos + replacement.Length() - 1);
+    str.BeginReading(iter);
+    iter.advance(pos + replacement.Length() - 1);
     str.EndReading(end);
   }
 }
 
 static bool DoFindInReadable(const nsACString& str, const nsACString& value)
 {
   nsACString::const_iterator start, end;
   str.BeginReading(start);