Bug 1305422 - part 4 - don't call size_forward in nsIDNService.cpp; r=erahm
authorNathan Froyd <froydnj@mozilla.com>
Thu, 29 Sep 2016 22:33:58 -0400
changeset 315874 a5b04e48b3e8e70b8a213afb75170da85c4d5b62
parent 315873 e208dfe24c94f7c3cddbc27df9e49d7fadc2acaf
child 315875 1c06cb170aa873c9ee4e18f111a600752eba6c22
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)
reviewerserahm
bugs1305422
milestone52.0a1
Bug 1305422 - part 4 - don't call size_forward in nsIDNService.cpp; r=erahm We don't need to bother with iterators here at all; we can just ask the string for its data and length directly.
netwerk/dns/nsIDNService.cpp
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -321,21 +321,18 @@ nsresult nsIDNService::ACEtoUTF8(const n
       _retval.Append(decodedBuf);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsIDNService::IsACE(const nsACString & input, bool *_retval)
 {
-  nsACString::const_iterator begin;
-  input.BeginReading(begin);
-
-  const char *data = begin.get();
-  uint32_t dataLen = begin.size_forward();
+  const char *data = input.BeginReading();
+  uint32_t dataLen = input.Length();
 
   // look for the ACE prefix in the input string.  it may occur
   // at the beginning of any segment in the domain name.  for
   // example: "www.xn--ENCODED.com"
 
   const char *p = PL_strncasestr(data, kACEPrefix, dataLen);
 
   *_retval = p && (p == data || *(p - 1) == '.');