Bug 942791 - Revert bug 427089. r=mayhemer a=lsblakk
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Tue, 10 Dec 2013 07:47:30 +0900
changeset 175267 0ae4bc68a5532b6a1fea3b61987e04353c6fd2f1
parent 175266 0e3bd70f2295b0bd0f082f8872945972359f1509
child 175268 f81e19286279a26bafc7ba611ff89e20b37ce694
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, lsblakk
bugs942791, 427089
milestone28.0a2
Bug 942791 - Revert bug 427089. r=mayhemer a=lsblakk
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/ftp/nsFtpConnectionThread.h
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -25,17 +25,16 @@
 #include "nsICacheService.h"
 #include "nsIURL.h"
 #include "nsISocketTransport.h"
 #include "nsIStreamListenerTee.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIStringBundle.h"
 #include "nsAuthInformationHolder.h"
-#include "nsICharsetConverterManager.h"
 #include "nsIProtocolProxyService.h"
 #include "nsICancelable.h"
 #include "nsICacheEntryDescriptor.h"
 #include "nsIOutputStream.h"
 #include "nsIPrompt.h"
 #include "nsIProtocolHandler.h"
 #include "nsIProxyInfo.h"
 #include "nsIRunnable.h"
@@ -1737,22 +1736,16 @@ nsFtpState::Init(nsFtpChannel *channel)
     if (!fwdPtr)
         return NS_ERROR_OUT_OF_MEMORY;
     if (*fwdPtr == '/')
         fwdPtr++;
     if (*fwdPtr != '\0') {
         // now unescape it... %xx reduced inline to resulting character
         int32_t len = NS_UnescapeURL(fwdPtr);
         mPath.Assign(fwdPtr, len);
-        if (IsUTF8(mPath)) {
-    	    nsAutoCString originCharset;
-    	    rv = mChannel->URI()->GetOriginCharset(originCharset);
-    	    if (NS_SUCCEEDED(rv) && !originCharset.EqualsLiteral("UTF-8"))
-    	        ConvertUTF8PathToCharset(originCharset);
-        }
 
 #ifdef DEBUG
         if (mPath.FindCharInSet(CRLF) >= 0)
             NS_ERROR("NewURI() should've prevented this!!!");
 #endif
     }
 
     // pull any username and/or password out of the uri
@@ -2450,63 +2443,8 @@ nsFtpState::CheckCache()
     if (pos != kNotFound)
         key.Truncate(pos);
     NS_ENSURE_FALSE(key.IsEmpty(), false);
 
     nsresult rv = session->AsyncOpenCacheEntry(key, accessReq, this, false);
     return NS_SUCCEEDED(rv);
 
 }
-
-nsresult
-nsFtpState::ConvertUTF8PathToCharset(const nsACString &aCharset)
-{
-    nsresult rv;
-    NS_ASSERTION(IsUTF8(mPath), "mPath isn't UTF8 string!");
-    NS_ConvertUTF8toUTF16 ucsPath(mPath);
-    nsAutoCString result;
-
-    nsCOMPtr<nsICharsetConverterManager> charsetMgr(
-        do_GetService("@mozilla.org/charset-converter-manager;1", &rv));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIUnicodeEncoder> encoder;
-    rv = charsetMgr->GetUnicodeEncoder(PromiseFlatCString(aCharset).get(),
-                                       getter_AddRefs(encoder));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    int32_t len = ucsPath.Length();
-    int32_t maxlen;
-
-    rv = encoder->GetMaxLength(ucsPath.get(), len, &maxlen);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    char buf[256], *p = buf;
-    if (uint32_t(maxlen) > sizeof(buf) - 1) {
-        p = (char *) malloc(maxlen + 1);
-        if (!p)
-            return NS_ERROR_OUT_OF_MEMORY;
-    }
-
-    rv = encoder->Convert(ucsPath.get(), &len, p, &maxlen);
-    if (NS_FAILED(rv))
-        goto end;
-    if (rv == NS_ERROR_UENC_NOMAPPING) {
-        NS_WARNING("unicode conversion failed");
-        rv = NS_ERROR_UNEXPECTED;
-        goto end;
-    }
-    p[maxlen] = 0;
-    result.Assign(p);
-
-    len = sizeof(buf) - 1;
-    rv = encoder->Finish(buf, &len);
-    if (NS_FAILED(rv))
-        goto end;
-    buf[len] = 0;
-    result.Append(buf);
-    mPath = result;
-
-end:
-    if (p != buf)
-        free(p);
-    return rv;
-}
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.h
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.h
@@ -139,17 +139,16 @@ private:
     nsresult StopProcessing();
     nsresult EstablishControlConnection();
     nsresult SendFTPCommand(const nsCSubstring& command);
     void ConvertFilespecToVMS(nsCString& fileSpec);
     void ConvertDirspecToVMS(nsCString& fileSpec);
     void ConvertDirspecFromVMS(nsCString& fileSpec);
     nsresult BuildStreamConverter(nsIStreamListener** convertStreamListener);
     nsresult SetContentType();
-    nsresult ConvertUTF8PathToCharset(const nsACString &aCharset);
 
     /**
      * This method is called to kick-off the FTP state machine.  mState is
      * reset to FTP_COMMAND_CONNECT, and the FTP state machine progresses from
      * there.  This method is initially called (indirectly) from the channel's
      * AsyncOpen implementation.
      */
     void Connect();