bug 78919, part 3: Move nsMIMEInfoImpl to exthandler, and don't allow to CreateInstance it

r=bzbarsky sr=darin
This commit is contained in:
cbiesinger%web.de 2004-01-28 14:48:22 +00:00
Родитель e04f6d3fa6
Коммит 242ffb7490
13 изменённых файлов: 32 добавлений и 457 удалений

Просмотреть файл

@ -116,12 +116,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppleFileDecoder)
///////////////////////////////////////////////////////////////////////////////
#include "nsMIMEInfoImpl.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEInfoImpl)
///////////////////////////////////////////////////////////////////////////////
#include "nsMIMEHeaderParamImpl.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl)
@ -878,12 +872,6 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
},
// from netwerk/mime:
{ "xml mime INFO",
NS_MIMEINFO_CID,
NS_MIMEINFO_CONTRACTID,
nsMIMEInfoImplConstructor
},
{ "mime header param",
NS_MIMEHEADERPARAM_CID,
NS_MIMEHEADERPARAM_CONTRACTID,

Просмотреть файл

@ -35,7 +35,6 @@ REQUIRES = xpcom \
$(NULL)
CPPSRCS = \
nsMIMEInfoImpl.cpp \
nsMIMEHeaderParamImpl.cpp \
$(NULL)

Просмотреть файл

@ -1,349 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMIMEInfoImpl.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsStringEnumerator.h"
// nsISupports methods
NS_IMPL_THREADSAFE_ISUPPORTS1(nsMIMEInfoImpl, nsIMIMEInfo)
// nsMIMEInfoImpl methods
nsMIMEInfoImpl::nsMIMEInfoImpl() {
mPreferredAction = nsIMIMEInfo::saveToDisk;
mAlwaysAskBeforeHandling = PR_TRUE;
}
nsMIMEInfoImpl::nsMIMEInfoImpl(const char *aMIMEType) :mMIMEType( aMIMEType ){
mPreferredAction = nsIMIMEInfo::saveToDisk;
mAlwaysAskBeforeHandling = PR_TRUE;
}
PRUint32
nsMIMEInfoImpl::GetExtCount() {
return mExtensions.Count();
}
NS_IMETHODIMP
nsMIMEInfoImpl::GetFileExtensions(nsIUTF8StringEnumerator** aResult)
{
return NS_NewUTF8StringEnumerator(aResult, &mExtensions, this);
}
NS_IMETHODIMP
nsMIMEInfoImpl::ExtensionExists(const char *aExtension, PRBool *_retval) {
NS_ASSERTION(aExtension, "no extension");
PRBool found = PR_FALSE;
PRUint32 extCount = mExtensions.Count();
if (extCount < 1) return NS_OK;
if (!aExtension) return NS_ERROR_NULL_POINTER;
nsDependentCString extension(aExtension);
for (PRUint8 i=0; i < extCount; i++) {
nsCString* ext = (nsCString*)mExtensions.CStringAt(i);
if (ext->Equals(extension, nsCaseInsensitiveCStringComparator())) {
found = PR_TRUE;
break;
}
}
*_retval = found;
return NS_OK;
}
NS_IMETHODIMP
nsMIMEInfoImpl::GetPrimaryExtension(char **_retval) {
PRUint32 extCount = mExtensions.Count();
if (extCount < 1) return NS_ERROR_NOT_INITIALIZED;
*_retval = ToNewCString(*(mExtensions.CStringAt(0)));
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
nsMIMEInfoImpl::SetPrimaryExtension(const char *aExtension) {
NS_ASSERTION(aExtension, "no extension");
PRUint32 extCount = mExtensions.Count();
nsCString extension(aExtension);
PRUint8 i;
PRBool found = PR_FALSE;
for (i=0; i < extCount; i++) {
nsCString* ext = (nsCString*)mExtensions.CStringAt(i);
if (ext->Equals(extension, nsCaseInsensitiveCStringComparator())) {
found = PR_TRUE;
break;
}
}
if (found) {
mExtensions.RemoveCStringAt(i);
}
mExtensions.InsertCStringAt(extension, 0);
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::AppendExtension(const char *aExtension)
{
mExtensions.AppendCString( nsCAutoString(aExtension) );
return NS_OK;
}
NS_IMETHODIMP
nsMIMEInfoImpl::Clone(nsIMIMEInfo** aClone) {
NS_ENSURE_ARG_POINTER(aClone);
nsMIMEInfoImpl* clone = new nsMIMEInfoImpl(mMIMEType.get());
if (!clone) {
*aClone = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
clone->mExtensions = mExtensions;
clone->mDescription = mDescription;
nsresult result = NS_OK;
clone->mMacType = mMacType;
clone->mMacCreator = mMacCreator;
if (mPreferredApplication) {
result = mPreferredApplication->Clone(getter_AddRefs(clone->mPreferredApplication));
NS_ASSERTION(NS_SUCCEEDED(result), "Failed to clone preferred handler application");
}
clone->mPreferredAction = mPreferredAction;
clone->mPreferredAppDescription = mPreferredAppDescription;
return CallQueryInterface(clone, aClone);
}
NS_IMETHODIMP
nsMIMEInfoImpl::GetMIMEType(char * *aMIMEType) {
if (!aMIMEType) return NS_ERROR_NULL_POINTER;
if (mMIMEType.IsEmpty())
return NS_ERROR_NOT_INITIALIZED;
*aMIMEType = ToNewCString(mMIMEType);
if (!*aMIMEType) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
nsMIMEInfoImpl::SetMIMEType(const char* aMIMEType) {
if (!aMIMEType) return NS_ERROR_NULL_POINTER;
mMIMEType=aMIMEType;
return NS_OK;
}
NS_IMETHODIMP
nsMIMEInfoImpl::GetDescription(PRUnichar * *aDescription) {
if (!aDescription) return NS_ERROR_NULL_POINTER;
*aDescription = ToNewUnicode(mDescription);
if (!*aDescription) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetDescription(const PRUnichar * aDescription)
{
mDescription = aDescription;
return NS_OK;
}
NS_IMETHODIMP
nsMIMEInfoImpl::Equals(nsIMIMEInfo *aMIMEInfo, PRBool *_retval) {
if (!aMIMEInfo) return NS_ERROR_NULL_POINTER;
nsXPIDLCString type;
nsresult rv = aMIMEInfo->GetMIMEType(getter_Copies(type));
if (NS_FAILED(rv)) return rv;
*_retval = mMIMEType.EqualsWithConversion(type);
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetMacType(PRUint32 *aMacType)
{
*aMacType = mMacType;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetMacType(PRUint32 aMacType)
{
mMacType = aMacType;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetMacCreator(PRUint32 *aMacCreator)
{
*aMacCreator = mMacCreator;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetMacCreator(PRUint32 aMacCreator)
{
mMacCreator = aMacCreator;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions )
{
mExtensions.Clear();
nsCString extList( aExtensions );
PRInt32 breakLocation = -1;
while ( (breakLocation= extList.FindChar(',') )!= -1)
{
nsCString ext( extList.get(), breakLocation );
mExtensions.AppendCString( ext );
extList.Cut(0, breakLocation+1 );
}
if ( !extList.IsEmpty() )
mExtensions.AppendCString( extList );
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetApplicationDescription(PRUnichar ** aApplicationDescription)
{
if (mPreferredAppDescription.IsEmpty() && mPreferredApplication) {
// Don't want to cache this, just in case someone resets the app
// without changing the description....
nsAutoString leafName;
mPreferredApplication->GetLeafName(leafName);
*aApplicationDescription = ToNewUnicode(leafName);
} else {
*aApplicationDescription = ToNewUnicode(mPreferredAppDescription);
}
return *aApplicationDescription ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetApplicationDescription(const PRUnichar * aApplicationDescription)
{
mPreferredAppDescription = aApplicationDescription;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetDefaultDescription(PRUnichar ** aDefaultDescription)
{
if (mDefaultAppDescription.IsEmpty() && mDefaultApplication) {
// Don't want to cache this, just in case someone resets the app
// without changing the description....
nsAutoString leafName;
mDefaultApplication->GetLeafName(leafName);
*aDefaultDescription = ToNewUnicode(leafName);
} else {
*aDefaultDescription = ToNewUnicode(mDefaultAppDescription);
}
return *aDefaultDescription ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetDefaultDescription(const PRUnichar * aDefaultDescription)
{
mDefaultAppDescription = aDefaultDescription;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredApplicationHandler(nsIFile ** aPreferredAppHandler)
{
*aPreferredAppHandler = mPreferredApplication;
NS_IF_ADDREF(*aPreferredAppHandler);
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredApplicationHandler(nsIFile * aPreferredAppHandler)
{
mPreferredApplication = aPreferredAppHandler;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetHasDefaultHandler(PRBool * _retval)
{
#ifdef XP_WIN
// On Windows, we ShellExecute any kind of file
// (defaultApplication is always null on windows, too)
// Most useful is probably presence/lack of default description
*_retval = !mDefaultAppDescription.IsEmpty();
#else
*_retval = mDefaultApplication != nsnull;
#endif
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetDefaultApplicationHandler(nsIFile ** aDefaultAppHandler)
{
*aDefaultAppHandler = mDefaultApplication;
NS_IF_ADDREF(*aDefaultAppHandler);
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetDefaultApplicationHandler(nsIFile * aDefaultAppHandler)
{
mDefaultApplication = aDefaultAppHandler;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredAction(nsMIMEInfoHandleAction * aPreferredAction)
{
*aPreferredAction = mPreferredAction;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredAction(nsMIMEInfoHandleAction aPreferredAction)
{
mPreferredAction = aPreferredAction;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetAlwaysAskBeforeHandling(PRBool * aAlwaysAsk)
{
*aAlwaysAsk = mAlwaysAskBeforeHandling;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetAlwaysAskBeforeHandling(PRBool aAlwaysAsk)
{
mAlwaysAskBeforeHandling = aAlwaysAsk;
return NS_OK;
}

Просмотреть файл

@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsmimeinfoimpl_h___
#define __nsmimeinfoimpl_h___
#include "nsIMIMEInfo.h"
#include "nsIAtom.h"
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsIFile.h"
#include "nsCOMPtr.h"
#include "nsIURI.h"
class nsMIMEInfoImpl : public nsIMIMEInfo {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMIMEINFO
// nsMIMEInfoImpl methods
nsMIMEInfoImpl();
nsMIMEInfoImpl(const char *aMIMEType);
virtual ~nsMIMEInfoImpl() {};
PRUint32 GetExtCount(); // returns the number of extensions associated.
// member variables
nsCStringArray mExtensions; // array of file extensions associated w/ this MIME obj
nsAutoString mDescription; // human readable description
PRUint32 mMacType, mMacCreator; // Mac file type and creator
protected:
nsCString mMIMEType;
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
nsCOMPtr<nsIFile> mDefaultApplication; // default application associated with this type.
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
nsString mPreferredAppDescription;
nsString mDefaultAppDescription;
PRBool mAlwaysAskBeforeHandling;
};
#endif //__nsmimeinfoimpl_h___

Просмотреть файл

@ -86,6 +86,8 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
OSHELPER += nsGNOMERegistry.cpp
endif
LOCAL_INCLUDES = -I$(srcdir)
EXPORTS = nsExternalHelperAppService.h \
nsExternalProtocolHandler.h \
$(OSDIR)/nsOSHelperAppService.h \
@ -105,6 +107,7 @@ endif
CPPSRCS = \
nsExternalHelperAppService.cpp \
nsExternalProtocolHandler.cpp \
nsMIMEInfoImpl.cpp \
$(OSHELPER) \
$(NULL)

Просмотреть файл

@ -160,7 +160,7 @@ nsresult nsOSHelperAppService::SetMIMEInfoForType(const char *aMIMEType, nsIMIME
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIMIMEInfo> mimeInfo (do_CreateInstance(NS_MIMEINFO_CONTRACTID));
nsCOMPtr<nsIMIMEInfo> mimeInfo = new nsMIMEInfoImpl();
if (mimeInfo) {
BMimeType mimeType(aMIMEType);
BMessage data;
@ -327,9 +327,10 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const char *aMIMEType, const char *aFile
return mi;
*aFound = PR_FALSE;
CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mi);
mi = new nsMIMEInfoImpl();
if (!mi)
return nsnull;
NS_ADDREF(mi);
if (aMIMEType && *aMIMEType)
mi->SetMIMEType(aMIMEType);
if (aFileExt && *aFileExt)

Просмотреть файл

@ -356,7 +356,7 @@ nsresult nsInternetConfigService::FillMIMEInfoForICEntry(ICMapEntry& entry, nsIM
{
// create a mime info object and we'll fill it in based on the values from IC mapping entry
nsresult rv = NS_OK;
nsCOMPtr<nsIMIMEInfo> info (do_CreateInstance(NS_MIMEINFO_CONTRACTID));
nsCOMPtr<nsIMIMEInfo> info (new nsMIMEInfoImpl());
if (info)
{
nsCAutoString mimetype ((char *)&entry.MIMEType[1], entry.MIMEType[0]);

Просмотреть файл

@ -288,9 +288,10 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const char * aMIMEType,
if (!mimeInfo) {
*aFound = PR_FALSE;
PR_LOG(mLog, PR_LOG_DEBUG, ("Creating new mimeinfo\n"));
CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mimeInfo);
mimeInfo = new nsMIMEInfoImpl();
if (!mimeInfo)
return nsnull;
NS_ADDREF(mimeInfo);
if (aMIMEType && *aMIMEType)
mimeInfo->SetMIMEType(aMIMEType);

Просмотреть файл

@ -36,6 +36,7 @@
#include "nsIHelperAppLauncherDialog.h"
#include "nsIMIMEInfo.h"
#include "nsMIMEInfoImpl.h"
#include "nsIMIMEService.h"
#include "nsIStreamListener.h"
#include "nsIFile.h"

Просмотреть файл

@ -1519,10 +1519,10 @@ nsOSHelperAppService::GetFromExtension(const char *aFileExt) {
return nsnull;
}
nsIMIMEInfo* mimeInfo = nsnull;
rv = CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mimeInfo);
if (NS_FAILED(rv))
nsIMIMEInfo* mimeInfo = new nsMIMEInfoImpl();
if (!mimeInfo)
return nsnull;
NS_ADDREF(mimeInfo);
mimeType = majorType + NS_LITERAL_STRING("/") + minorType;
mimeInfo->SetMIMEType(NS_ConvertUCS2toUTF8(mimeType).get());
@ -1648,10 +1648,10 @@ nsOSHelperAppService::GetFromType(const char *aMIMEType) {
extensions,
mime_types_description);
nsIMIMEInfo* mimeInfo = nsnull;
rv = CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mimeInfo);
if (NS_FAILED(rv))
nsIMIMEInfo* mimeInfo = new nsMIMEInfoImpl();
if (!mimeInfo)
return nsnull;
NS_ADDREF(mimeInfo);
mimeInfo->SetFileExtensions(PromiseFlatCString(NS_ConvertUCS2toUTF8(extensions)).get());
mimeInfo->SetMIMEType(aMIMEType);
@ -1703,8 +1703,9 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const char *aType,
// If we got nothing, make a new mimeinfo
if (!retval) {
*aFound = PR_FALSE;
CallCreateInstance(NS_MIMEINFO_CONTRACTID, &retval);
retval = new nsMIMEInfoImpl();
if (retval) {
NS_ADDREF(retval);
if (aType && *aType)
retval->SetMIMEType(aType);
if (aFileExt && *aFileExt)

Просмотреть файл

@ -42,6 +42,7 @@
#include "nsString.h"
#include "nsIComponentManager.h"
#include "nsILocalFile.h"
#include "nsMIMEInfoImpl.h"
#include <glib.h>
#include <glib-object.h>
@ -263,7 +264,7 @@ nsGNOMERegistry::GetFromType(const char *aMIMEType)
if (!handlerApp)
return nsnull;
mimeInfo = do_CreateInstance(NS_MIMEINFO_CONTRACTID);
mimeInfo = new nsMIMEInfoImpl();
NS_ENSURE_TRUE(mimeInfo, nsnull);
mimeInfo->SetMIMEType(aMIMEType);

Просмотреть файл

@ -1431,10 +1431,10 @@ nsOSHelperAppService::GetFromExtension(const char *aFileExt) {
return nsnull;
}
nsIMIMEInfo* mimeInfo = nsnull;
rv = CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mimeInfo);
if (NS_FAILED(rv))
nsIMIMEInfo* mimeInfo = new nsMIMEInfoImpl();
if (!mimeInfo)
return nsnull;
NS_ADDREF(mimeInfo);
mimeType = majorType + NS_LITERAL_STRING("/") + minorType;
mimeInfo->SetMIMEType(NS_ConvertUCS2toUTF8(mimeType).get());
@ -1580,10 +1580,10 @@ nsOSHelperAppService::GetFromType(const char *aMIMEType) {
return nsnull;
}
nsIMIMEInfo* mimeInfo = nsnull;
rv = CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mimeInfo);
if (NS_FAILED(rv))
nsIMIMEInfo* mimeInfo = new nsMIMEInfoImpl();
if (!mimeInfo)
return nsnull;
NS_ADDREF(mimeInfo);
mimeInfo->SetFileExtensions(NS_ConvertUCS2toUTF8(extensions).get());
mimeInfo->SetMIMEType(aMIMEType);
@ -1637,8 +1637,9 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const char *aType,
// If we got nothing, make a new mimeinfo
if (!retval) {
*aFound = PR_FALSE;
CallCreateInstance(NS_MIMEINFO_CONTRACTID, &retval);
retval = new nsMIMEInfoImpl();
if (retval) {
NS_ADDREF(retval);
if (aType && *aType)
retval->SetMIMEType(aType);
if (aFileExt && *aFileExt)

Просмотреть файл

@ -408,10 +408,10 @@ already_AddRefed<nsIMIMEInfo> nsOSHelperAppService::GetByExtension(const char *a
nsAutoString description;
PRBool found = GetValueString(hKey, NULL, description);
nsIMIMEInfo* mimeInfo = nsnull;
CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mimeInfo);
nsIMIMEInfo* mimeInfo = new nsMIMEInfoImpl();
if (mimeInfo)
{
NS_ADDREF(mimeInfo);
if (!typeToUse.IsEmpty())
mimeInfo->SetMIMEType(typeToUse.get());
// don't append the '.'
@ -504,8 +504,9 @@ already_AddRefed<nsIMIMEInfo> nsOSHelperAppService::GetMIMEInfoFromOS(const char
}
if (!miByExt && !mi) {
*aFound = PR_FALSE;
CallCreateInstance(NS_MIMEINFO_CONTRACTID, &mi);
mi = new nsMIMEInfoImpl();
if (mi) {
NS_ADDREF(mi);
if (aMIMEType && *aMIMEType)
mi->SetMIMEType(aMIMEType);
if (aFileExt && *aFileExt)