Port uriloader to 64-bit Mac OS X. b=489344 r=smichaud sr=roc
authorJosh Aas <joshmoz@gmail.com>
Wed, 22 Apr 2009 09:06:58 -0400
changeset 27621 9f7ea11dab12209a3f858d6033c0fb68b0a3f031
parent 27620 221b58f349ccb0dd7996aff3a4ba4776df629279
child 27622 579f615bb510728fcc1372e8a714f6d1278e9b69
push id6656
push userjosh@mozilla.com
push dateWed, 22 Apr 2009 13:04:51 +0000
treeherdermozilla-central@9f7ea11dab12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, roc
bugs489344
milestone1.9.2a1pre
Port uriloader to 64-bit Mac OS X. b=489344 r=smichaud sr=roc
uriloader/exthandler/mac/nsInternetConfig.mm
uriloader/exthandler/mac/nsInternetConfigService.mm
uriloader/exthandler/nsExternalHelperAppService.cpp
uriloader/exthandler/nsIInternetConfigService.idl
--- a/uriloader/exthandler/mac/nsInternetConfig.mm
+++ b/uriloader/exthandler/mac/nsInternetConfig.mm
@@ -52,40 +52,39 @@ PRInt32  nsInternetConfig::sRefCount = 0
 static OSType GetAppCreatorCode()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   ProcessSerialNumber psn = { 0, kCurrentProcess } ;
   ProcessInfoRec      procInfo;
   
   procInfo.processInfoLength = sizeof(ProcessInfoRec);
-  procInfo.processName = nsnull;
-  procInfo.processAppSpec = nsnull;
-  
+  procInfo.processName = NULL;
+#ifndef __LP64__
+  procInfo.processAppSpec = NULL;
+#else
+  procInfo.processAppRef = NULL;
+#endif
+
   GetProcessInformation(&psn, &procInfo);
   return procInfo.processSignature;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0x0);
 }
 
 
 
 ICInstance nsInternetConfig::GetInstance()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
 	if ( !sInstance )
 	{
-		OSStatus err;
-		if ((long)ICStart == kUnresolvedCFragSymbolAddress )
-			return sInstance;                          
-                                                                                 
-                                                                                  
 		OSType creator = GetAppCreatorCode();
-		err = ::ICStart( &sInstance, creator  );
+		OSStatus err = ::ICStart( &sInstance, creator  );
 		if ( err != noErr )
 		{
 			::ICStop( sInstance );
 		}
 		else
 		{
 			::ICGetSeed( sInstance, &sSeed );
 		}
--- a/uriloader/exthandler/mac/nsInternetConfigService.mm
+++ b/uriloader/exthandler/mac/nsInternetConfigService.mm
@@ -463,111 +463,16 @@ NS_IMETHODIMP nsInternetConfigService::G
     if (err == noErr)
       rv = FillMIMEInfoForICEntry(entry,_retval);
   }
   return rv;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-
-NS_IMETHODIMP nsInternetConfigService::GetFileMappingFlags(FSSpec* fsspec, PRBool lookupByExtensionFirst, PRInt32 *_retval)
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
-
-  nsresult  rv = NS_ERROR_FAILURE;
-  OSStatus  err = noErr;
-
-  NS_ENSURE_ARG(_retval);
-  *_retval = -1;
-  
-  ICInstance instance = nsInternetConfig::GetInstance();
-  if (instance)
-  {
-    ICMapEntry  entry;
-    
-    if (lookupByExtensionFirst)
-      err = ::ICMapFilename(instance, fsspec->name, &entry);
-  
-    if (!lookupByExtensionFirst || err != noErr)
-    {
-      FInfo info;
-      err = FSpGetFInfo(fsspec, &info);
-      if (err == noErr)
-        err = ::ICMapTypeCreator(instance, info.fdType, info.fdCreator, fsspec->name, &entry);
-    }
-
-    if (err == noErr)
-      *_retval = entry.flags;
-     
-     rv = NS_OK;
-  }
-  return rv;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
-}
-
-
-/* void GetDownloadFolder (out FSSpec fsspec); */
-NS_IMETHODIMP nsInternetConfigService::GetDownloadFolder(FSSpec *fsspec)
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
-
-  ICInstance  inst = nsInternetConfig::GetInstance();
-  OSStatus    err;
-  Handle      prefH;
-  nsresult    rv = NS_ERROR_FAILURE;
-  
-  NS_ENSURE_ARG_POINTER(fsspec);
-  
-  if (inst)
-  {
-    err = ::ICBegin(inst, icReadOnlyPerm);
-    if (err == noErr)
-    {
-      prefH = ::NewHandle(256); // ICFileSpec ~= 112 bytes + variable, 256 bytes hopefully is sufficient
-      if (prefH)
-      {
-        ICAttr  attr;
-        err = ::ICFindPrefHandle(inst, kICDownloadFolder, &attr, prefH);
-        if (err == noErr)
-        {
-          err = ::Munger(prefH, 0, NULL, kICFileSpecHeaderSize, (Ptr)-1, 0);
-          if (err == noErr)
-          {
-            Boolean wasChanged;
-            err = ::ResolveAlias(NULL, (AliasHandle)prefH, fsspec, &wasChanged);
-            if (err == noErr)
-            {
-              rv = NS_OK;
-            }
-            else
-            { // ResolveAlias for the DownloadFolder failed - try grabbing the FSSpec
-              err = ::ICFindPrefHandle(inst, kICDownloadFolder, &attr, prefH);
-              if (err == noErr)
-              { // Use FSMakeFSSpec to verify the saved FSSpec is still valid
-                FSSpec  tempSpec = (*(ICFileSpecHandle)prefH)->fss;
-                err = ::FSMakeFSSpec(tempSpec.vRefNum, tempSpec.parID, tempSpec.name, fsspec);
-                if (err == noErr)
-                  rv = NS_OK;
-              }
-            }
-          }
-        }
-        // Best not to leave that handle laying around
-        DisposeHandle(prefH);
-      }
-      err = ::ICEnd(inst);
-    }
-  }
-  return rv;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
-}
-
 nsresult nsInternetConfigService::GetICKeyPascalString(PRUint32 inIndex, const unsigned char*& outICKey)
 {
   nsresult  rv = NS_OK;
 
   switch (inIndex)
   {
     case eICColor_WebBackgroundColour: outICKey = kICWebBackgroundColour; break;
     case eICColor_WebReadColor:        outICKey = kICWebReadColor;        break;
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -88,17 +88,19 @@
 #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"
 #include "nsIInternetConfigService.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 "nsEscape.h"
 
 #include "nsIStringBundle.h" // XXX needed to localize error msgs
@@ -1378,17 +1380,17 @@ nsresult nsExternalAppHandler::SetUpTemp
                                    PR_WRONLY | PR_CREATE_FILE, 0600);
   if (NS_FAILED(rv)) {
     mTempFile->Remove(PR_FALSE);
     return rv;
   }
 
   mOutStream = NS_BufferOutputStream(outputStream, BUFFERED_OUTPUT_SIZE);
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && !defined(__LP64__)
     nsCAutoString contentType;
     mMimeInfo->GetMIMEType(contentType);
     if (contentType.LowerCaseEqualsLiteral(APPLICATION_APPLEFILE) ||
         contentType.LowerCaseEqualsLiteral(MULTIPART_APPLEDOUBLE))
     {
       nsCOMPtr<nsIAppleFileDecoder> appleFileDecoder = do_CreateInstance(NS_IAPPLEFILEDECODER_CONTRACTID, &rv);
       if (NS_SUCCEEDED(rv))
       {
--- a/uriloader/exthandler/nsIInternetConfigService.idl
+++ b/uriloader/exthandler/nsIInternetConfigService.idl
@@ -47,17 +47,17 @@ interface nsIURL;
 #define NS_INTERNETCONFIGSERVICE_CONTRACTID \
 "@mozilla.org/mac/internet-config-service;1"
 
 %}
 
 native FSSpec(FSSpec);
 [ptr] native FSSpecPtr(FSSpec);
 
-[scriptable, uuid(9B8B9D80-5F4F-11D4-9696-0060083A0BCF)]
+[scriptable, uuid(38C37AA2-9F74-4B24-A70C-AC3AE4308210)]
 interface nsIInternetConfigService : nsISupports
 {
   const unsigned long eICColor_WebBackgroundColour = 1;
   const unsigned long eICColor_WebReadColor = 2;
   const unsigned long eICColor_WebTextColor = 3;
   const unsigned long eICColor_WebUnreadColor = 4;
   const unsigned long eICBoolean_WebUnderlineLinks = 11;
   const unsigned long eICString_WWWHomePage = 101;
@@ -112,20 +112,15 @@ interface nsIInternetConfigService : nsI
   boolean hasProtocolHandler(in string protocol);
   
   // pass in a mime type or a file extension.....
   void fillInMIMEInfo(in string mimetype, in string aFileExtension, out nsIMIMEInfo mimeinfo);
   
   void getMIMEInfoFromExtension(in string aFileExt, out nsIMIMEInfo mimeinfo);
   
   void getMIMEInfoFromTypeCreator(in PRUint32 aType, in PRUint32 aCreator, in string aFileExt, out nsIMIMEInfo mimeInfo);
-  
-  //Return a File Mapping for the specified file. If no mapping found, return -1.
-  [noscript] long getFileMappingFlags(in FSSpecPtr fsspec, in boolean lookupByExtensionFirst);
-  
-  [noscript] void getDownloadFolder(out FSSpec fsspec);
-  
+
   ACString getString(in unsigned long keyenum);
 
   unsigned long getColor(in unsigned long keyenum);
 
   boolean getBoolean(in unsigned long keyenum);
 };