Backed out changeset 5739a7f790f2 (bug 1333899) for failing reftest svg-image-datauri-1.html on Linux opt and pgo. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 22 Feb 2017 10:00:50 +0100
changeset 373252 b593e365b72df20e16ae74994275cd228749e5e5
parent 373251 65061c29c70cfacf1abd77d2429688941881b07d
child 373253 37c22fd0475e9ecddb207d5eed729ab4a1945ad7
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1333899
milestone54.0a1
backs out5739a7f790f2e171af618eec42ecfeaf9d681433
Backed out changeset 5739a7f790f2 (bug 1333899) for failing reftest svg-image-datauri-1.html on Linux opt and pgo. r=backout
xpcom/io/nsEscape.cpp
xpcom/io/nsEscape.h
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -570,53 +570,36 @@ NS_EscapeURL(const nsAFlatString& aStr, 
 }
 
 #define ISHEX(c) memchr(hexCharsUpperLower, c, sizeof(hexCharsUpperLower)-1)
 
 bool
 NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
                nsACString& aResult)
 {
-  bool didAppend = false;
-  nsresult rv = NS_UnescapeURL(aStr, aLen, aFlags, aResult, didAppend,
-                               mozilla::fallible);
-  if (rv == NS_ERROR_OUT_OF_MEMORY) {
-    ::NS_ABORT_OOM(aLen * sizeof(nsACString::char_type));
-  }
-
-  return didAppend;
-}
-
-nsresult
-NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
-               nsACString& aResult, bool& aDidAppend,
-               const mozilla::fallible_t&)
-{
   if (!aStr) {
     NS_NOTREACHED("null pointer");
-    return NS_ERROR_INVALID_ARG;
+    return false;
   }
 
   MOZ_ASSERT(aResult.IsEmpty(),
              "Passing a non-empty string as an out parameter!");
 
   if (aLen < 0) {
     aLen = strlen(aStr);
   }
 
   bool ignoreNonAscii = !!(aFlags & esc_OnlyASCII);
   bool ignoreAscii = !!(aFlags & esc_OnlyNonASCII);
   bool writing = !!(aFlags & esc_AlwaysCopy);
   bool skipControl = !!(aFlags & esc_SkipControl);
   bool skipInvalidHostChar = !!(aFlags & esc_Host);
 
   if (writing) {
-    if (!aResult.SetCapacity(aLen, mozilla::fallible)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    aResult.SetCapacity(aLen);
   }
 
   const char* last = aStr;
   const char* p = aStr;
 
   for (int i = 0; i < aLen; ++i, ++p) {
     if (*p == HEX_ESCAPE && i < aLen - 2) {
       unsigned char c1 = *((unsigned char*)p + 1);
@@ -624,36 +607,27 @@ NS_UnescapeURL(const char* aStr, int32_t
       unsigned char u = (UNHEX(c1) << 4) + UNHEX(c2);
       if (ISHEX(c1) && ISHEX(c2) &&
           (!skipInvalidHostChar || dontNeedEscape(u, aFlags) || c1 >= '8') &&
           ((c1 < '8' && !ignoreAscii) || (c1 >= '8' && !ignoreNonAscii)) &&
           !(skipControl &&
             (c1 < '2' || (c1 == '7' && (c2 == 'f' || c2 == 'F'))))) {
         if (!writing) {
           writing = true;
-          if (!aResult.SetCapacity(aLen, mozilla::fallible)) {
-            return NS_ERROR_OUT_OF_MEMORY;
-          }
+          aResult.SetCapacity(aLen);
         }
         if (p > last) {
-          if (!aResult.Append(last, p - last, mozilla::fallible)) {
-            return NS_ERROR_OUT_OF_MEMORY;
-          }
+          aResult.Append(last, p - last);
           last = p;
         }
-        if (!aResult.Append(u, mozilla::fallible)) {
-          return NS_ERROR_OUT_OF_MEMORY;
-        }
+        aResult.Append(u);
         i += 2;
         p += 2;
         last += 3;
       }
     }
   }
   if (writing && last < aStr + aLen) {
-    if (!aResult.Append(last, aStr + aLen - last, mozilla::fallible)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    aResult.Append(last, aStr + aLen - last);
   }
 
-  aDidAppend = writing;
-  return NS_OK;
+  return writing;
 }
--- a/xpcom/io/nsEscape.h
+++ b/xpcom/io/nsEscape.h
@@ -137,26 +137,16 @@ bool NS_EscapeURL(const char* aStr,
  * @return true if aResult was written to (i.e. at least one character was
  *              unescaped or esc_AlwaysCopy was requested), false otherwise.
  */
 bool NS_UnescapeURL(const char* aStr,
                     int32_t aLen,
                     uint32_t aFlags,
                     nsACString& aResult);
 
-/**
- * Fallible version of |NS_UnescapeURL|.
- */
-nsresult NS_UnescapeURL(const char* aStr,
-                        int32_t aLen,
-                        uint32_t aFlags,
-                        nsACString& aResult,
-                        bool& aAppended,
-                        const mozilla::fallible_t&);
-
 /** returns resultant string length **/
 inline int32_t
 NS_UnescapeURL(char* aStr)
 {
   return nsUnescapeCount(aStr);
 }
 
 /**
@@ -182,17 +172,16 @@ NS_EscapeURL(const nsCSubstring& aStr, u
 inline const nsCSubstring&
 NS_UnescapeURL(const nsCSubstring& aStr, uint32_t aFlags, nsCSubstring& aResult)
 {
   if (NS_UnescapeURL(aStr.Data(), aStr.Length(), aFlags, aResult)) {
     return aResult;
   }
   return aStr;
 }
-
 const nsSubstring&
 NS_EscapeURL(const nsSubstring& aStr, uint32_t aFlags, nsSubstring& aResult);
 
 /**
  * Percent-escapes all characters in aStr that occurs in aForbidden.
  * @param aStr the input URL string
  * @param aForbidden the characters that should be escaped if found in aStr
  * @note that aForbidden MUST be sorted (low to high)