Bug 925083: Remove support/code for nsIAppleFileDecoder. r=mcmanus
authorJosh Aas <joshmoz@gmail.com>
Fri, 11 Oct 2013 02:32:47 -0500
changeset 150441 266532efd5cb59da40ea3755ecc16fb2507991b1
parent 150440 80ceb04b7183a8bb5f5f589559d2b5831040cfb6
child 150442 b49e069aeddd057e53289d045bb5ca57808dcda0
push id25442
push userryanvm@gmail.com
push dateFri, 11 Oct 2013 19:39:21 +0000
treeherdermozilla-central@342e9d40235a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs925083
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 925083: Remove support/code for nsIAppleFileDecoder. r=mcmanus
netwerk/build/nsNetModule.cpp
netwerk/streamconv/public/moz.build
netwerk/streamconv/public/nsIAppleFileDecoder.idl
netwerk/streamconv/src/moz.build
netwerk/streamconv/src/nsAppleFileDecoder.cpp
netwerk/streamconv/src/nsAppleFileDecoder.h
uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -37,21 +37,17 @@
 #include "nsCategoryCache.h"
 #include "nsIContentSniffer.h"
 #include "nsNetUtil.h"
 #include "nsIThreadPool.h"
 #include "mozilla/net/NeckoChild.h"
 
 #include "nsNetCID.h"
 
-#if defined(XP_MACOSX)
-#if !defined(__LP64__)
-#define BUILD_APPLEFILE_DECODER 1
-#endif
-#else
+#ifndef XP_MACOSX
 #define BUILD_BINHEX_DECODER 1
 #endif
 
 typedef nsCategoryCache<nsIContentSniffer> ContentSnifferCache;
 NS_HIDDEN_(ContentSnifferCache*) gNetSniffers = nullptr;
 NS_HIDDEN_(ContentSnifferCache*) gDataSniffers = nullptr;
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -138,25 +134,16 @@ net_NewIncrementalDownload(nsISupports *
     0xa62af1ba,                                      \
     0x79b3,                                          \
     0x4896,                                          \
     {0x8a, 0xaf, 0xb1, 0x48, 0xbf, 0xce, 0x42, 0x80} \
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "nsStreamConverterService.h"
-
-#ifdef BUILD_APPLEFILE_DECODER
-#include "nsAppleFileDecoder.h"
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppleFileDecoder)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-
 #include "nsMIMEHeaderParamImpl.h"
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "nsRequestObserverProxy.h"
 #include "nsSimpleStreamListener.h"
 #include "nsDirIndexParser.h"
@@ -371,16 +358,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroid
 
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef NECKO_PROTOCOL_ftp
 #include "nsFTPDirListingConv.h"
 nsresult NS_NewFTPDirListingConv(nsFTPDirListingConv** result);
 #endif
 
+#include "nsStreamConverterService.h"
 #include "nsMultiMixedConv.h"
 #include "nsHTTPCompressConv.h"
 #include "mozTXTToHTMLConv.h"
 #include "nsUnknownDecoder.h"
 #include "nsTXTToHTMLConv.h"
 #include "nsIndexedToHTML.h"
 #ifdef BUILD_BINHEX_DECODER
 #include "nsBinHexDecoder.h"
@@ -716,19 +704,16 @@ NS_DEFINE_NAMED_CID(NS_AUTHURLPARSER_CID
 NS_DEFINE_NAMED_CID(NS_STANDARDURL_CID);
 NS_DEFINE_NAMED_CID(NS_ARRAYBUFFERINPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_BUFFEREDINPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_BUFFEREDOUTPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_MIMEINPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_PROTOCOLPROXYSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_STREAMCONVERTERSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_DASHBOARD_CID);
-#ifdef BUILD_APPLEFILE_DECODER
-NS_DEFINE_NAMED_CID(NS_APPLEFILEDECODER_CID);
-#endif
 #ifdef NECKO_PROTOCOL_ftp
 NS_DEFINE_NAMED_CID(NS_FTPDIRLISTINGCONVERTER_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_NSINDEXEDTOHTMLCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_DIRINDEXPARSER_CID);
 NS_DEFINE_NAMED_CID(NS_MULTIMIXEDCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_UNKNOWNDECODER_CID);
 NS_DEFINE_NAMED_CID(NS_BINARYDETECTOR_CID);
@@ -854,19 +839,16 @@ static const mozilla::Module::CIDEntry k
     { &kNS_STANDARDURL_CID, false, nullptr, nsStandardURLConstructor },
     { &kNS_ARRAYBUFFERINPUTSTREAM_CID, false, nullptr, ArrayBufferInputStreamConstructor },
     { &kNS_BUFFEREDINPUTSTREAM_CID, false, nullptr, nsBufferedInputStream::Create },
     { &kNS_BUFFEREDOUTPUTSTREAM_CID, false, nullptr, nsBufferedOutputStream::Create },
     { &kNS_MIMEINPUTSTREAM_CID, false, nullptr, nsMIMEInputStreamConstructor },
     { &kNS_PROTOCOLPROXYSERVICE_CID, true, nullptr, nsProtocolProxyServiceConstructor },
     { &kNS_STREAMCONVERTERSERVICE_CID, false, nullptr, CreateNewStreamConvServiceFactory },
     { &kNS_DASHBOARD_CID, false, nullptr, mozilla::net::DashboardConstructor },
-#ifdef BUILD_APPLEFILE_DECODER
-    { &kNS_APPLEFILEDECODER_CID, false, nullptr, nsAppleFileDecoderConstructor },
-#endif
 #ifdef NECKO_PROTOCOL_ftp
     { &kNS_FTPDIRLISTINGCONVERTER_CID, false, nullptr, CreateNewFTPDirListingConv },
 #endif
     { &kNS_NSINDEXEDTOHTMLCONVERTER_CID, false, nullptr, nsIndexedToHTML::Create },
     { &kNS_DIRINDEXPARSER_CID, false, nullptr, nsDirIndexParserConstructor },
     { &kNS_MULTIMIXEDCONVERTER_CID, false, nullptr, CreateNewMultiMixedConvFactory },
     { &kNS_UNKNOWNDECODER_CID, false, nullptr, CreateNewUnknownDecoderFactory },
     { &kNS_BINARYDETECTOR_CID, false, nullptr, CreateNewBinaryDetectorFactory },
@@ -994,19 +976,16 @@ static const mozilla::Module::ContractID
     { NS_STANDARDURL_CONTRACTID, &kNS_STANDARDURL_CID },
     { NS_ARRAYBUFFERINPUTSTREAM_CONTRACTID, &kNS_ARRAYBUFFERINPUTSTREAM_CID },
     { NS_BUFFEREDINPUTSTREAM_CONTRACTID, &kNS_BUFFEREDINPUTSTREAM_CID },
     { NS_BUFFEREDOUTPUTSTREAM_CONTRACTID, &kNS_BUFFEREDOUTPUTSTREAM_CID },
     { NS_MIMEINPUTSTREAM_CONTRACTID, &kNS_MIMEINPUTSTREAM_CID },
     { NS_PROTOCOLPROXYSERVICE_CONTRACTID, &kNS_PROTOCOLPROXYSERVICE_CID },
     { NS_STREAMCONVERTERSERVICE_CONTRACTID, &kNS_STREAMCONVERTERSERVICE_CID },
     { NS_DASHBOARD_CONTRACTID, &kNS_DASHBOARD_CID },
-#ifdef BUILD_APPLEFILE_DECODER
-    { NS_IAPPLEFILEDECODER_CONTRACTID, &kNS_APPLEFILEDECODER_CID },
-#endif
 #ifdef NECKO_PROTOCOL_ftp
     { NS_ISTREAMCONVERTER_KEY FTP_TO_INDEX, &kNS_FTPDIRLISTINGCONVERTER_CID },
 #endif
     { NS_ISTREAMCONVERTER_KEY INDEX_TO_HTML, &kNS_NSINDEXEDTOHTMLCONVERTER_CID },
     { NS_DIRINDEXPARSER_CONTRACTID, &kNS_DIRINDEXPARSER_CID },
     { NS_ISTREAMCONVERTER_KEY MULTI_MIXED_X, &kNS_MULTIMIXEDCONVERTER_CID },
     { NS_ISTREAMCONVERTER_KEY MULTI_BYTERANGES, &kNS_MULTIMIXEDCONVERTER_CID },
     { NS_ISTREAMCONVERTER_KEY MULTI_MIXED, &kNS_MULTIMIXEDCONVERTER_CID },
--- a/netwerk/streamconv/public/moz.build
+++ b/netwerk/streamconv/public/moz.build
@@ -8,19 +8,14 @@ XPIDL_SOURCES += [
     'mozITXTToHTMLConv.idl',
     'nsIDirIndex.idl',
     'nsIDirIndexListener.idl',
     'nsIStreamConverter.idl',
     'nsIStreamConverterService.idl',
     'nsITXTToHTMLConv.idl',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
-    XPIDL_SOURCES += [
-        'nsIAppleFileDecoder.idl',
-    ]
-
 XPIDL_MODULE = 'necko_strconv'
 
 MODULE = 'necko'
 
 FAIL_ON_WARNINGS = True
 
deleted file mode 100644
--- a/netwerk/streamconv/public/nsIAppleFileDecoder.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIOutputStream.idl"
-
-interface nsIFile;
-
-%{C++
-#define NS_APPLEFILEDECODER_CID                      \
-{ /* 3a2bb281-64b8-11d5-9daa-bb433143c53c */         \
-    0x3a2bb281,                                      \
-    0x64b8,                                          \
-    0x11d5,                                          \
-    {0x9d, 0xaa, 0xbb, 0x43, 0x31, 0x43, 0xc5, 0x3c} \
-}
-
-#define NS_IAPPLEFILEDECODER_CONTRACTID     "@mozilla.org/applefiledecoder;1"
-%}
-
-
-[scriptable, uuid(3a2bb280-64b8-11d5-9daa-bb433143c53c)]
-interface nsIAppleFileDecoder : nsIOutputStream {
-
-    /**
-     * Initialize the Apple File Decoder Output stream.
-     *
-     * @param outputStream     The output stream which the AppleFile Decoder will write to the data fork.
-     * @param outputFile       The output file which the AppleFile Decoder will write to the resource fork.
-     */
-    void Initialize(in nsIOutputStream outputStream, in nsIFile outputFile);
-};
--- a/netwerk/streamconv/src/moz.build
+++ b/netwerk/streamconv/src/moz.build
@@ -7,21 +7,14 @@
 MODULE = 'necko'
 
 FAIL_ON_WARNINGS = True
 
 CPP_SOURCES += [
     'nsStreamConverterService.cpp',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['OS_TEST'] != 'x86_64':
-    # nsAppleFileDecoder.cpp has warnings I don't understand.
-    FAIL_ON_WARNINGS = False
-    CPP_SOURCES += [
-        'nsAppleFileDecoder.cpp',
-    ]
-
 LIBRARY_NAME = 'nkconv_s'
 
 LIBXUL_LIBRARY = True
 
 MSVC_ENABLE_PGO = True
 
deleted file mode 100644
--- a/netwerk/streamconv/src/nsAppleFileDecoder.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
-#include "nsAppleFileDecoder.h"
-#include "prmem.h"
-#include "prnetdb.h"
-#include "nsCRT.h"
-
-
-NS_IMPL_ISUPPORTS2(nsAppleFileDecoder, nsIAppleFileDecoder, nsIOutputStream)
-
-nsAppleFileDecoder::nsAppleFileDecoder()
-{
-  m_state = parseHeaders;
-  m_dataBufferLength = 0;
-  m_dataBuffer = (unsigned char*) PR_MALLOC(MAX_BUFFERSIZE);
-  m_entries = nullptr;
-  m_rfRefNum = -1;
-  m_totalDataForkWritten = 0;
-  m_totalResourceForkWritten = 0;
-  m_headerOk = false;
-  
-  m_comment[0] = 0;
-  memset(&m_dates, 0, sizeof(m_dates));
-  memset(&m_finderInfo, 0, sizeof(m_dates));
-  memset(&m_finderExtraInfo, 0, sizeof(m_dates));
-}
-
-nsAppleFileDecoder::~nsAppleFileDecoder()
-{
-  if (m_output)
-    Close();
-
-  PR_FREEIF(m_dataBuffer);
-  if (m_entries)
-    delete [] m_entries;
-}
-
-NS_IMETHODIMP nsAppleFileDecoder::Initialize(nsIOutputStream *outputStream, nsIFile *outputFile)
-{
-  m_output = outputStream;
-  
-  nsCOMPtr<nsILocalFileMac> macFile = do_QueryInterface(outputFile);
-  bool saveFollowLinks;
-  macFile->GetFollowLinks(&saveFollowLinks);
-  macFile->SetFollowLinks(true);
-  macFile->GetFSSpec(&m_fsFileSpec);
-  macFile->SetFollowLinks(saveFollowLinks);
-
-  m_offset = 0;
-  m_dataForkOffset = 0;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsAppleFileDecoder::Close(void)
-{
-  nsresult rv;
-  rv = m_output->Close();
-
-  int32_t i;
-
-  if (m_rfRefNum != -1)
-    FSClose(m_rfRefNum);
-    
-  /* Check if the file is complete and if it's the case, write file attributes */
-  if (m_headerOk)
-  {
-    bool dataOk = true; /* It's ok if the file doesn't have a datafork, therefore set it to true by default. */
-    if (m_headers.magic == APPLESINGLE_MAGIC)
-    {
-      for (i = 0; i < m_headers.entriesCount; i ++)
-        if (ENT_DFORK == m_entries[i].id)
-        {
-          dataOk = (bool)(m_totalDataForkWritten == m_entries[i].length);
-          break;
-        }
-    }
-
-    bool resourceOk = FALSE;
-    for (i = 0; i < m_headers.entriesCount; i ++)
-      if (ENT_RFORK == m_entries[i].id)
-      {
-        resourceOk = (bool)(m_totalResourceForkWritten == m_entries[i].length);
-        break;
-      }
-      
-    if (dataOk && resourceOk)
-    {
-      HFileInfo *fpb;
-      CInfoPBRec cipbr;
-      
-      fpb = (HFileInfo *) &cipbr;
-      fpb->ioVRefNum = m_fsFileSpec.vRefNum;
-      fpb->ioDirID   = m_fsFileSpec.parID;
-      fpb->ioNamePtr = m_fsFileSpec.name;
-      fpb->ioFDirIndex = 0;
-      PBGetCatInfoSync(&cipbr);
-
-      /* set finder info */
-      memcpy(&fpb->ioFlFndrInfo, &m_finderInfo, sizeof (FInfo));
-      memcpy(&fpb->ioFlXFndrInfo, &m_finderExtraInfo, sizeof (FXInfo));
-      fpb->ioFlFndrInfo.fdFlags &= 0xfc00; /* clear flags maintained by finder */
-      
-      /* set file dates */
-      fpb->ioFlCrDat = m_dates.create - CONVERT_TIME;
-      fpb->ioFlMdDat = m_dates.modify - CONVERT_TIME;
-      fpb->ioFlBkDat = m_dates.backup - CONVERT_TIME;
-    
-      /* update file info */
-      fpb->ioDirID = fpb->ioFlParID;
-      PBSetCatInfoSync(&cipbr);
-      
-      /* set comment */
-      IOParam vinfo;
-      GetVolParmsInfoBuffer vp;
-      DTPBRec dtp;
-
-      memset((void *) &vinfo, 0, sizeof (vinfo));
-      vinfo.ioVRefNum = fpb->ioVRefNum;
-      vinfo.ioBuffer  = (Ptr) &vp;
-      vinfo.ioReqCount = sizeof (vp);
-      if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr && ((vp.vMAttrib >> bHasDesktopMgr) & 1)) 
-      {
-        memset((void *) &dtp, 0, sizeof (dtp));
-        dtp.ioVRefNum = fpb->ioVRefNum;
-        if (PBDTGetPath(&dtp) == noErr) 
-        {
-          dtp.ioDTBuffer = (Ptr) &m_comment[1];
-          dtp.ioNamePtr  = fpb->ioNamePtr;
-          dtp.ioDirID    = fpb->ioDirID;
-          dtp.ioDTReqCount = m_comment[0];
-          if (PBDTSetCommentSync(&dtp) == noErr) 
-            PBDTFlushSync(&dtp);
-        }
-      }
-    }
-  }
-  
-  /* setting m_headerOk to false will prevent us to reprocess the header in case the Close function is called several time*/
-  m_headerOk = false;
-
-  return rv;
-}
-
-NS_IMETHODIMP nsAppleFileDecoder::Flush(void)
-{
-  return m_output->Flush();
-} 
-
-NS_IMETHODIMP nsAppleFileDecoder::WriteFrom(nsIInputStream *inStr, uint32_t count, uint32_t *_retval)
-{
-  return m_output->WriteFrom(inStr, count, _retval);
-}
-
-NS_IMETHODIMP nsAppleFileDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, uint32_t count, uint32_t *_retval)
-{
-  return m_output->WriteSegments(reader, closure, count, _retval);
-}
-
-NS_IMETHODIMP nsAppleFileDecoder::IsNonBlocking(bool *aNonBlocking)
-{
-  return m_output->IsNonBlocking(aNonBlocking);
-}
-
-NS_IMETHODIMP nsAppleFileDecoder::Write(const char *buffer, uint32_t bufferSize, uint32_t* writeCount)
-{
-  /* WARNING: to simplify my life, I presume that I should get all appledouble headers in the first block,
-              else I would have to implement a buffer */
-
-  const char * buffPtr = buffer;
-  uint32_t dataCount;
-  int32_t i;
-  nsresult rv = NS_OK;
-
-  *writeCount = 0;
-  
-  while (bufferSize > 0 && NS_SUCCEEDED(rv))
-  {
-    switch (m_state)
-    {
-      case parseHeaders :
-        dataCount = sizeof(ap_header) - m_dataBufferLength;
-        if (dataCount > bufferSize)
-          dataCount = bufferSize;
-        memcpy(&m_dataBuffer[m_dataBufferLength], buffPtr, dataCount);
-        m_dataBufferLength += dataCount;
-        
-        if (m_dataBufferLength == sizeof(ap_header))
-        {
-          memcpy(&m_headers, m_dataBuffer, sizeof(ap_header));
-          m_headers.magic   = (int32_t)PR_ntohl((uint32_t)m_headers.magic);
-          m_headers.version = (int32_t)PR_ntohl((uint32_t)m_headers.version);
-          // m_headers.fill is required to be all zeroes; no endian issues
-          m_headers.entriesCount =
-            (int16_t)PR_ntohs((uint16_t)m_headers.entriesCount);
-
-          /* Check header to be sure we are dealing with the right kind of data, else just write it to the data fork. */
-          if ((m_headers.magic == APPLEDOUBLE_MAGIC || m_headers.magic == APPLESINGLE_MAGIC) && 
-              m_headers.version == VERSION && m_headers.entriesCount)
-          {
-            /* Just to be sure, the filler must contains only 0 */
-            for (i = 0; i < 4 && m_headers.fill[i] == 0L; i ++)
-              ;
-            if (i == 4)
-              m_state = parseEntries;
-          }
-          m_dataBufferLength = 0;
-          
-          if (m_state == parseHeaders)
-          {
-            dataCount = 0;
-            m_state = parseWriteThrough;
-          }
-        }
-        break;
-      
-      case parseEntries :
-        {
-        if (!m_entries)
-        {
-          m_entries = new ap_entry[m_headers.entriesCount];
-          if (!m_entries)
-            return NS_ERROR_OUT_OF_MEMORY;
-        }
-        uint32_t entriesSize = sizeof(ap_entry) * m_headers.entriesCount;
-        dataCount = entriesSize - m_dataBufferLength;
-        if (dataCount > bufferSize)
-          dataCount = bufferSize;
-        memcpy(&m_dataBuffer[m_dataBufferLength], buffPtr, dataCount);
-        m_dataBufferLength += dataCount;
-
-        if (m_dataBufferLength == entriesSize)
-        {
-          for (i = 0; i < m_headers.entriesCount; i ++)
-          {
-            memcpy(&m_entries[i], &m_dataBuffer[i * sizeof(ap_entry)], sizeof(ap_entry));
-            m_entries[i].id     = (int32_t)PR_ntohl((uint32_t)m_entries[i].id);
-            m_entries[i].offset =
-              (int32_t)PR_ntohl((uint32_t)m_entries[i].offset);
-            m_entries[i].length =
-              (int32_t)PR_ntohl((uint32_t)m_entries[i].length);
-            if (m_headers.magic == APPLEDOUBLE_MAGIC)
-            {
-              uint32_t offset = m_entries[i].offset + m_entries[i].length;
-              if (offset > m_dataForkOffset)
-                m_dataForkOffset = offset;
-            }
-          }
-          m_headerOk = true;          
-          m_state = parseLookupPart;
-        }
-        }
-        break;
-      
-      case parseLookupPart :
-        /* which part are we parsing? */
-        m_currentPartID = -1;
-        for (i = 0; i < m_headers.entriesCount; i ++)
-          if (m_offset == m_entries[i].offset && m_entries[i].length)
-          {
-              m_currentPartID = m_entries[i].id;
-              m_currentPartLength = m_entries[i].length;
-              m_currentPartCount = 0;
-
-              switch (m_currentPartID)
-              {
-                case ENT_DFORK    : m_state = parseDataFork;           break;
-                case ENT_RFORK    : m_state = parseResourceFork;       break;
-
-                case ENT_COMMENT  :
-                case ENT_DATES    :
-                case ENT_FINFO    :
-                  m_dataBufferLength = 0;
-                  m_state = parsePart;
-                  break;
-                
-                default           : m_state = parseSkipPart;           break;
-              }
-              break;
-          }
-          
-        if (m_currentPartID == -1)
-        {
-          /* maybe is the datafork of an appledouble file? */
-          if (m_offset == m_dataForkOffset)
-          {
-              m_currentPartID = ENT_DFORK;
-              m_currentPartLength = -1;
-              m_currentPartCount = 0;
-              m_state = parseDataFork;
-          }
-          else
-            dataCount = 1;
-        }        
-        break;
-      
-      case parsePart :
-        dataCount = m_currentPartLength - m_dataBufferLength;
-        if (dataCount > bufferSize)
-          dataCount = bufferSize;
-        memcpy(&m_dataBuffer[m_dataBufferLength], buffPtr, dataCount);
-        m_dataBufferLength += dataCount;
-        
-        if (m_dataBufferLength == m_currentPartLength)
-        {
-          switch (m_currentPartID)
-          {
-            case ENT_COMMENT  :
-              m_comment[0] = m_currentPartLength > 255 ? 255 : m_currentPartLength;
-              memcpy(&m_comment[1], buffPtr, m_comment[0]);
-              break;
-            case ENT_DATES    :
-              if (m_currentPartLength == sizeof(m_dates)) {
-                memcpy(&m_dates, buffPtr, m_currentPartLength);
-                m_dates.create = (int32_t)PR_ntohl((uint32_t)m_dates.create);
-                m_dates.modify = (int32_t)PR_ntohl((uint32_t)m_dates.modify);
-                m_dates.backup = (int32_t)PR_ntohl((uint32_t)m_dates.backup);
-                m_dates.access = (int32_t)PR_ntohl((uint32_t)m_dates.access);
-              }
-              break;
-            case ENT_FINFO    :
-              if (m_currentPartLength == (sizeof(m_finderInfo) + sizeof(m_finderExtraInfo)))
-              {
-                memcpy(&m_finderInfo, buffPtr, sizeof(m_finderInfo));
-                // OSType (four character codes) are still integers; swap them.
-                m_finderInfo.fdType =
-                  (OSType)PR_ntohl((uint32_t)m_finderInfo.fdType);
-                m_finderInfo.fdCreator =
-                  (OSType)PR_ntohl((uint32_t)m_finderInfo.fdCreator);
-                m_finderInfo.fdFlags =
-                  (UInt16)PR_ntohs((uint16_t)m_finderInfo.fdFlags);
-                m_finderInfo.fdLocation.v =
-                  (short)PR_ntohs((uint16_t)m_finderInfo.fdLocation.v);
-                m_finderInfo.fdLocation.h =
-                  (short)PR_ntohs((uint16_t)m_finderInfo.fdLocation.h);
-                m_finderInfo.fdFldr =
-                  (SInt16)PR_ntohs((uint16_t)m_finderInfo.fdFldr);
-
-                memcpy(&m_finderExtraInfo, buffPtr + sizeof(m_finderInfo), sizeof(m_finderExtraInfo));
-                m_finderExtraInfo.fdIconID =
-                  (SInt16)PR_ntohs((uint16_t)m_finderExtraInfo.fdIconID);
-                m_finderExtraInfo.fdReserved[0] =
-                  (SInt16)PR_ntohs((uint16_t)m_finderExtraInfo.fdReserved[0]);
-                m_finderExtraInfo.fdReserved[1] =
-                  (SInt16)PR_ntohs((uint16_t)m_finderExtraInfo.fdReserved[1]);
-                m_finderExtraInfo.fdReserved[2] =
-                  (SInt16)PR_ntohs((uint16_t)m_finderExtraInfo.fdReserved[2]);
-                // fdScript is a byte
-                // fdXFlags is a byte
-                m_finderExtraInfo.fdComment =
-                  (SInt16)PR_ntohs((uint16_t)m_finderExtraInfo.fdComment);
-                m_finderExtraInfo.fdPutAway =
-                  (SInt32)PR_ntohl((uint32_t)m_finderExtraInfo.fdPutAway);
-              }
-              break;
-          }
-          m_state = parseLookupPart;
-        }
-        break;
-      
-      case parseSkipPart :
-        dataCount = m_currentPartLength - m_currentPartCount;
-        if (dataCount > bufferSize)
-          dataCount = bufferSize;
-        else
-          m_state = parseLookupPart;
-        break;
-      
-      case parseDataFork :
-        if (m_headers.magic == APPLEDOUBLE_MAGIC)
-          dataCount = bufferSize;
-        else
-        {
-          dataCount = m_currentPartLength - m_currentPartCount;
-          if (dataCount > bufferSize)
-            dataCount = bufferSize;
-          else
-            m_state = parseLookupPart;
-        }
-        
-        if (m_output)
-        {
-          uint32_t writeCount;
-          rv = m_output->Write((const char *)buffPtr, dataCount, &writeCount);
-          if (dataCount != writeCount)
-            rv = NS_ERROR_FAILURE;
-          m_totalDataForkWritten += dataCount;
-        }
-        
-        break;
-      
-      case parseResourceFork :
-        {
-        dataCount = m_currentPartLength - m_currentPartCount;
-        if (dataCount > bufferSize)
-          dataCount = bufferSize;
-        else
-          m_state = parseLookupPart;
-        
-        if (m_rfRefNum == -1)
-        {
-          if (noErr != FSpOpenRF(&m_fsFileSpec, fsWrPerm, &m_rfRefNum))
-            return NS_ERROR_FAILURE;
-        }
-        
-        long count = dataCount;
-        if (noErr != FSWrite(m_rfRefNum, &count, buffPtr) || count != dataCount)
-            return NS_ERROR_FAILURE;
-        m_totalResourceForkWritten += dataCount;
-        }
-        break;
-      
-      case parseWriteThrough :
-        dataCount = bufferSize;
-        if (m_output)
-        {
-          uint32_t writeCount;
-          rv = m_output->Write((const char *)buffPtr, dataCount, &writeCount);
-          if (dataCount != writeCount)
-            rv = NS_ERROR_FAILURE;
-        }
-        break;
-    }
-
-    if (dataCount)
-    {
-      *writeCount += dataCount;
-      bufferSize -= dataCount;
-      buffPtr += dataCount;
-      m_currentPartCount += dataCount;
-      m_offset += dataCount;
-      dataCount = 0;
-    }
-  }
-
-  return rv;
-}
deleted file mode 100644
--- a/netwerk/streamconv/src/nsAppleFileDecoder.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsAppleFileDecoder_h__
-#define nsAppleFileDecoder_h__
-
-#include "nsIAppleFileDecoder.h"
-#include "nsILocalFileMac.h"
-
-/*
-** applefile definitions used 
-*/
-#if PRAGMA_STRUCT_ALIGN
-  #pragma options align=mac68k
-#endif
-
-#define APPLESINGLE_MAGIC   0x00051600L
-#define APPLEDOUBLE_MAGIC 	0x00051607L
-#define VERSION             0x00020000
-
-#define NUM_ENTRIES 		6
-
-#define ENT_DFORK   		1L
-#define ENT_RFORK   		2L
-#define ENT_NAME    		3L
-#define ENT_COMMENT 		4L
-#define ENT_DATES   		8L
-#define ENT_FINFO   		9L
-
-#define CONVERT_TIME 		1265437696L
-
-/*
-** data type used in the header decoder.
-*/
-typedef struct ap_header 
-{
-	int32_t 	magic;
-	int32_t   version;
-	int32_t 	fill[4];
-	int16_t 	entriesCount;
-
-} ap_header;
-
-typedef struct ap_entry 
-{
-	int32_t   id;
-	int32_t	  offset;
-	int32_t	  length;
-	
-} ap_entry;
-
-typedef struct ap_dates 
-{
-	int32_t create, modify, backup, access;
-
-} ap_dates;
-
-#if PRAGMA_STRUCT_ALIGN
-  #pragma options align=reset
-#endif
-
-/*
-**Error codes
-*/
-enum {
-  errADNotEnoughData = -12099,
-  errADNotSupported,
-  errADBadVersion
-};
-
-
-class nsAppleFileDecoder : public nsIAppleFileDecoder
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOUTPUTSTREAM
-  NS_DECL_NSIAPPLEFILEDECODER 
-   
-  nsAppleFileDecoder();
-  virtual ~nsAppleFileDecoder();
-  
-private:
-  #define MAX_BUFFERSIZE    1024
-  enum ParserState {parseHeaders, parseEntries, parseLookupPart, parsePart, parseSkipPart,
-                    parseDataFork, parseResourceFork, parseWriteThrough};
-  
-  nsCOMPtr<nsIOutputStream> m_output;
-  FSSpec            m_fsFileSpec;
-  SInt16            m_rfRefNum;
-  
-  unsigned char *   m_dataBuffer;
-  int32_t           m_dataBufferLength;
-  ParserState       m_state;
-  ap_header         m_headers;
-  ap_entry *        m_entries;
-  int32_t           m_offset;
-  int32_t           m_dataForkOffset;
-  int32_t           m_totalDataForkWritten;
-  int32_t           m_totalResourceForkWritten;
-  bool              m_headerOk;
-  
-  int32_t           m_currentPartID;
-  int32_t           m_currentPartLength;
-  int32_t           m_currentPartCount;
-  
-  Str255            m_comment;
-  ap_dates          m_dates;
-  FInfo             m_finderInfo;
-  FXInfo            m_finderExtraInfo;
-};
-
-#endif
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -65,19 +65,16 @@
 #include "nsIEncodedChannel.h"
 #include "nsIMultiPartChannel.h"
 #include "nsIFileChannel.h"
 #include "nsIObserverService.h" // so we can be a profile change observer
 #include "nsIPropertyBag2.h" // for the 64-bit content length
 
 #ifdef XP_MACOSX
 #include "nsILocalFileMac.h"
-#ifndef __LP64__
-#include "nsIAppleFileDecoder.h"
-#endif
 #elif defined(XP_OS2)
 #include "nsILocalFileOS2.h"
 #endif
 
 #include "nsIPluginHost.h" // XXX needed for ext->type mapping (bug 233289)
 #include "nsPluginHost.h"
 #include "nsEscape.h"