diff --git a/mozilla/content/html/style/src/nsCSSScanner.cpp b/mozilla/content/html/style/src/nsCSSScanner.cpp
index 04f97d78efc..5ae0604a653 100644
--- a/mozilla/content/html/style/src/nsCSSScanner.cpp
+++ b/mozilla/content/html/style/src/nsCSSScanner.cpp
@@ -37,6 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCSSScanner.h"
+#include "nsIFactory.h"
#include "nsIInputStream.h"
#include "nsIUnicharInputStream.h"
#include "nsString.h"
diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp b/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp
index 6b10d54a4fe..85b7e3cd5ed 100644
--- a/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp
+++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp
@@ -88,9 +88,10 @@ RegisterComponents()
nsIGenericFactory* fact;
// Register the factory for all supporting interfaces.
- nsCOMPtr compMgr = do_GetService(kComponentManagerCID, &rv);
- if (NS_FAILED(rv)) return rv;
- nsCOMPtr registrar(do_QueryInterface(compMgr));
+ nsCOMPtr registrar;
+ rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
+ if (NS_FAILED(rv))
+ return rv;
// Register nsQABrowserView
rv = NS_NewGenericFactory(&fact, gQAEmbeddingModuleViewInfo);
@@ -196,4 +197,4 @@ NSGetFactory(nsISupports* aServMgr,
return rv;
}
-#endif
\ No newline at end of file
+#endif
diff --git a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp
index 58d1dd20988..b6486117087 100644
--- a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp
@@ -47,6 +47,7 @@
#include "nsICategoryManager.h"
#include "nsIComponentLoader.h"
#include "nsIComponentManager.h"
+#include "nsIComponentManagerObsolete.h"
#include "nsIGenericFactory.h"
#include "nsILocalFile.h"
#include "nsIModule.h"
diff --git a/mozilla/layout/build/nsContentHTTPStartup.h b/mozilla/layout/build/nsContentHTTPStartup.h
index 8afda80705a..aab45d07fce 100644
--- a/mozilla/layout/build/nsContentHTTPStartup.h
+++ b/mozilla/layout/build/nsContentHTTPStartup.h
@@ -47,6 +47,7 @@
{0xa1, 0xf5, 0xc8, 0x24, 0xef, 0xa4, 0x23, 0x1b} }
struct nsModuleComponentInfo;
+class nsIFile;
class nsContentHTTPStartup : public nsIObserver
{
diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp
index 04f97d78efc..5ae0604a653 100644
--- a/mozilla/layout/style/nsCSSScanner.cpp
+++ b/mozilla/layout/style/nsCSSScanner.cpp
@@ -37,6 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCSSScanner.h"
+#include "nsIFactory.h"
#include "nsIInputStream.h"
#include "nsIUnicharInputStream.h"
#include "nsString.h"
diff --git a/mozilla/mailnews/base/src/nsMsgWindow.cpp b/mozilla/mailnews/base/src/nsMsgWindow.cpp
index 4b635da80f8..07502162fcc 100644
--- a/mozilla/mailnews/base/src/nsMsgWindow.cpp
+++ b/mozilla/mailnews/base/src/nsMsgWindow.cpp
@@ -74,7 +74,6 @@
#include "nsIExternalProtocolService.h"
static NS_DEFINE_CID(kTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
-static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
NS_IMPL_THREADSAFE_ISUPPORTS3(nsMsgWindow,
nsIMsgWindow,
@@ -95,24 +94,20 @@ nsMsgWindow::~nsMsgWindow()
nsresult nsMsgWindow::Init()
{
// register ourselves as a content listener with the uri dispatcher service
- nsresult rv = NS_OK;
+ nsresult rv;
nsCOMPtr dispatcher =
do_GetService(NS_URI_LOADER_CONTRACTID, &rv);
- if (NS_SUCCEEDED(rv))
- rv = dispatcher->RegisterContentListener(this);
+ if (NS_FAILED(rv))
+ return rv;
+
+ rv = dispatcher->RegisterContentListener(this);
+ if (NS_FAILED(rv))
+ return rv;
// create Undo/Redo Transaction Manager
- nsCOMPtr compMgr =
- do_GetService(kComponentManagerCID, &rv);
-
+ mTransactionManager = do_CreateInstance(kTransactionManagerCID, &rv);
if (NS_SUCCEEDED(rv))
- {
- rv = compMgr->CreateInstance(kTransactionManagerCID, nsnull,
- NS_GET_IID(nsITransactionManager),
- getter_AddRefs(mTransactionManager));
- if (NS_SUCCEEDED(rv))
- mTransactionManager->SetMaxTransactionCount(-1);
- }
+ mTransactionManager->SetMaxTransactionCount(-1);
return rv;
}
diff --git a/mozilla/mailnews/import/src/nsImportService.cpp b/mozilla/mailnews/import/src/nsImportService.cpp
index 5eee441b3f1..8fef64a45f0 100644
--- a/mozilla/mailnews/import/src/nsImportService.cpp
+++ b/mozilla/mailnews/import/src/nsImportService.cpp
@@ -70,7 +70,6 @@
PRLogModuleInfo *IMPORTLOGMODULE = nsnull;
-static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static nsIImportService * gImportService = nsnull;
static const char * kWhitespace = "\b\t\r\n ";
@@ -533,14 +532,11 @@ nsresult nsImportService::LoadModuleInfo( const char *pClsId, const char *pSuppo
// load the component and get all of the info we need from it....
// then call AddModule
nsresult rv;
- nsCOMPtr compMgr =
- do_GetService(kComponentManagerCID, &rv);
- if (NS_FAILED(rv)) return rv;
-
+
nsCID clsId;
clsId.Parse( pClsId);
nsIImportModule * module;
- rv = compMgr->CreateInstance( clsId, nsnull, NS_GET_IID(nsIImportModule), (void **) &module);
+ rv = CallCreateInstance( clsId, &module);
if (NS_FAILED(rv)) return rv;
nsString theTitle;
@@ -579,11 +575,7 @@ nsIImportModule *ImportModuleDesc::GetModule( PRBool keepLoaded)
}
nsresult rv;
- nsCOMPtr compMgr =
- do_GetService(kComponentManagerCID, &rv);
- if (NS_FAILED(rv)) return nsnull;
-
- rv = compMgr->CreateInstance( m_cid, nsnull, NS_GET_IID(nsIImportModule), (void **) &m_pModule);
+ rv = CallCreateInstance( m_cid, &m_pModule);
if (NS_FAILED(rv)) {
m_pModule = nsnull;
return nsnull;
diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp
index 8ffc6b037c8..f5c24459fac 100644
--- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp
+++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp
@@ -220,7 +220,6 @@ static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
static const char kDirectoryServiceContractID[] = "@mozilla.org/file/directory_service;1";
// for the dialog
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
-static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
@@ -5029,7 +5028,8 @@ nsresult nsPluginHostImpl::FindPlugins(PRBool aCreatePluginList, PRBool * aPlugi
// Read cached plugins info
ReadPluginInfo();
- nsCOMPtr compManager = do_GetService(kComponentManagerCID, &rv);
+ nsCOMPtr compManager;
+ NS_GetComponentManager(getter_AddRefs(compManager));
if (compManager)
LoadXPCOMPlugins(compManager);
@@ -6508,7 +6508,8 @@ nsPluginHostImpl::ScanForRealInComponentsFolder(nsIComponentManager * aCompManag
if (NS_FAILED(pluginFile.GetPluginInfo(info)))
return rv;
- nsCOMPtr compManager = do_GetService(kComponentManagerCID, &rv);
+ nsCOMPtr compManager;
+ NS_GetComponentManager(getter_AddRefs(compManager));
// finally, create our "plugin tag" and add it to the list
if (info.fMimeTypeArray) {
diff --git a/mozilla/rdf/base/src/nsRDFService.cpp b/mozilla/rdf/base/src/nsRDFService.cpp
index 23571dd477c..90c2f324a93 100644
--- a/mozilla/rdf/base/src/nsRDFService.cpp
+++ b/mozilla/rdf/base/src/nsRDFService.cpp
@@ -72,6 +72,7 @@
#include "nsIRDFService.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsIServiceManager.h"
+#include "nsIFactory.h"
#include "nsRDFCID.h"
#include "nsString.h"
#include "nsWeakReference.h"
diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp
index 1ce5ea669ae..5d3aefefa3f 100644
--- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp
+++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp
@@ -58,6 +58,7 @@
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
+#include "nsIFactory.h"
#include "nsIEventQueueService.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
diff --git a/mozilla/xpcom/build/dlldeps.cpp b/mozilla/xpcom/build/dlldeps.cpp
index 85c7294c032..77855c74b5d 100644
--- a/mozilla/xpcom/build/dlldeps.cpp
+++ b/mozilla/xpcom/build/dlldeps.cpp
@@ -187,10 +187,10 @@ void XXXNeverCalled()
NS_CopyUnicodeToNative(str1, str2);
{
nsID id;
- nsComponentManager::CreateInstance(id, nsnull, id, nsnull);
- nsComponentManager::CreateInstance("", nsnull, id, nsnull);
- nsComponentManager::GetClassObject(id, id, nsnull);
- nsComponentManager::GetClassObjectByContractID("", id, nsnull);
+ CallCreateInstance(id, nsnull, id, nsnull);
+ CallCreateInstance("", nsnull, id, nsnull);
+ CallGetClassObject(id, id, nsnull);
+ CallGetClassObjectByContractID("", id, nsnull);
nsServiceManager::GetGlobalServiceManager(nsnull);
}
diff --git a/mozilla/xpcom/components/Makefile.in b/mozilla/xpcom/components/Makefile.in
index 686148543b2..218ab0f238a 100644
--- a/mozilla/xpcom/components/Makefile.in
+++ b/mozilla/xpcom/components/Makefile.in
@@ -65,7 +65,6 @@ endif
EXPORTS = \
nsCategoryManagerUtils.h \
- nsComponentManagerUtils.h \
nsComponentManagerObsolete.h \
nsIServiceManagerUtils.h \
nsIServiceManagerObsolete.h \
diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp
index 9265389b0c5..bf2dd827111 100644
--- a/mozilla/xpcom/components/nsComponentManager.cpp
+++ b/mozilla/xpcom/components/nsComponentManager.cpp
@@ -2769,7 +2769,6 @@ nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
// Normalize proid and classname
const char *contractID = (aContractID && *aContractID) ? aContractID : nsnull;
- const char *className = (aClassName && *aClassName) ? aClassName : nsnull;
#ifdef PR_LOGGING
if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING))
{
diff --git a/mozilla/xpcom/components/nsComponentManager.h b/mozilla/xpcom/components/nsComponentManager.h
index df128125fd4..a1a27219198 100644
--- a/mozilla/xpcom/components/nsComponentManager.h
+++ b/mozilla/xpcom/components/nsComponentManager.h
@@ -65,6 +65,21 @@ class nsFactoryEntry;
class nsDll;
class nsIServiceManager;
+#define NS_COMPONENTMANAGER_CID \
+{ /* 91775d60-d5dc-11d2-92fb-00e09805570f */ \
+ 0x91775d60, \
+ 0xd5dc, \
+ 0x11d2, \
+ {0x92, 0xfb, 0x00, 0xe0, 0x98, 0x05, 0x57, 0x0f} \
+}
+
+/* keys for registry use */
+extern const char xpcomKeyName[];
+extern const char xpcomComponentsKeyName[];
+extern const char lastModValueName[];
+extern const char fileSizeValueName[];
+extern const char nativeComponentType[];
+extern const char staticComponentType[];
// Predefined loader types. Do not change the numbers.
// NATIVE should be 0 as it is being used as the first array index.
diff --git a/mozilla/xpcom/components/nsComponentManagerObsolete.cpp b/mozilla/xpcom/components/nsComponentManagerObsolete.cpp
index 34602e089bb..c87dc293162 100644
--- a/mozilla/xpcom/components/nsComponentManagerObsolete.cpp
+++ b/mozilla/xpcom/components/nsComponentManagerObsolete.cpp
@@ -67,7 +67,7 @@ nsresult
nsComponentManager::GetClassObject(const nsCID &aClass, const nsIID &aIID,
void **aResult)
{
- // XXX still in use by nsComponentManagerUtils.h
+ NS_NOTREACHED("nsComponentManager::GetClassObject is deprecated");
nsIComponentManagerObsolete* cm;
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
@@ -80,7 +80,7 @@ nsComponentManager::GetClassObjectByContractID(const char *aContractID,
const nsIID &aIID,
void **aResult)
{
- // XXX still in use by nsComponentManagerUtils.h
+ NS_NOTREACHED("nsComponentManager::GetClassObjectByContractID is deprecated");
nsCOMPtr cm;
nsresult rv = NS_GetComponentManager(getter_AddRefs(cm));
@@ -119,7 +119,7 @@ nsComponentManager::CreateInstance(const nsCID &aClass,
const nsIID &aIID,
void **aResult)
{
- // XXX still in use by nsComponentManagerUtils.h
+ NS_NOTREACHED("nsComponentManager::CreateInstance is deprecated");
nsIComponentManagerObsolete* cm;
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
@@ -133,7 +133,7 @@ nsComponentManager::CreateInstance(const char *aContractID,
const nsIID &aIID,
void **aResult)
{
- // XXX still in use by nsComponentManagerUtils.h
+ NS_NOTREACHED("nsComponentManager::CreateInstance is deprecated");
nsIComponentManagerObsolete* cm;
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
diff --git a/mozilla/xpcom/components/nsComponentManagerUtils.h b/mozilla/xpcom/components/nsComponentManagerUtils.h
deleted file mode 100644
index 9eb9418ea0d..00000000000
--- a/mozilla/xpcom/components/nsComponentManagerUtils.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 of 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 MPL, 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 MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsComponentManagerUtils_h__
-#define nsComponentManagerUtils_h__
-
-/*
- * Do not include this file directly. Instead,
- * |#include "nsIComponentManager.h"|.
- */
-
-#ifndef nsCOMPtr_h__
-#include "nsCOMPtr.h"
-#endif
-
-#ifndef nsComponentManagerObsolete_h___
-#include "nsComponentManagerObsolete.h"
-#endif
-
-#define NS_COMPONENTMANAGER_CID \
-{ /* 91775d60-d5dc-11d2-92fb-00e09805570f */ \
- 0x91775d60, \
- 0xd5dc, \
- 0x11d2, \
- {0x92, 0xfb, 0x00, 0xe0, 0x98, 0x05, 0x57, 0x0f} \
-}
-
-class NS_COM nsCreateInstanceByCID : public nsCOMPtr_helper
-{
-public:
- nsCreateInstanceByCID( const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr )
- : mCID(aCID),
- mOuter(aOuter),
- mErrorPtr(aErrorPtr)
- {
- // nothing else to do here
- }
-
- virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-
-private:
- const nsCID& mCID;
- nsISupports* mOuter;
- nsresult* mErrorPtr;
-};
-
-class NS_COM nsCreateInstanceByContractID : public nsCOMPtr_helper
-{
-public:
- nsCreateInstanceByContractID( const char* aContractID, nsISupports* aOuter, nsresult* aErrorPtr )
- : mContractID(aContractID),
- mOuter(aOuter),
- mErrorPtr(aErrorPtr)
- {
- // nothing else to do here
- }
-
- virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-
-private:
- const char* mContractID;
- nsISupports* mOuter;
- nsresult* mErrorPtr;
-};
-
-class NS_COM nsCreateInstanceFromFactory : public nsCOMPtr_helper
-{
-public:
- nsCreateInstanceFromFactory( nsIFactory* aFactory, nsISupports* aOuter, nsresult* aErrorPtr )
- : mFactory(aFactory),
- mOuter(aOuter),
- mErrorPtr(aErrorPtr)
- {
- // nothing else to do here
- }
-
- virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-
-private:
- nsIFactory* mFactory;
- nsISupports* mOuter;
- nsresult* mErrorPtr;
-};
-
-
-inline
-const nsCreateInstanceByCID
-do_CreateInstance( const nsCID& aCID, nsresult* error = 0 )
-{
- return nsCreateInstanceByCID(aCID, 0, error);
-}
-
-inline
-const nsCreateInstanceByCID
-do_CreateInstance( const nsCID& aCID, nsISupports* aOuter, nsresult* error = 0 )
-{
- return nsCreateInstanceByCID(aCID, aOuter, error);
-}
-
-inline
-const nsCreateInstanceByContractID
-do_CreateInstance( const char* aContractID, nsresult* error = 0 )
-{
- return nsCreateInstanceByContractID(aContractID, 0, error);
-}
-
-inline
-const nsCreateInstanceByContractID
-do_CreateInstance( const char* aContractID, nsISupports* aOuter, nsresult* error = 0 )
-{
- return nsCreateInstanceByContractID(aContractID, aOuter, error);
-}
-
-inline
-const nsCreateInstanceFromFactory
-do_CreateInstance( nsIFactory* aFactory, nsresult* error = 0 )
-{
- return nsCreateInstanceFromFactory(aFactory, 0, error);
-}
-
-inline
-const nsCreateInstanceFromFactory
-do_CreateInstance( nsIFactory* aFactory, nsISupports* aOuter, nsresult* error = 0 )
-{
- return nsCreateInstanceFromFactory(aFactory, aOuter, error);
-}
-
-
-class NS_COM nsGetClassObjectByCID : public nsCOMPtr_helper
-{
-public:
- nsGetClassObjectByCID( const nsCID& aCID, nsresult* aErrorPtr )
- : mCID(aCID),
- mErrorPtr(aErrorPtr)
- {
- // nothing else to do here
- }
-
- virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-
-private:
- const nsCID& mCID;
- nsresult* mErrorPtr;
-};
-
-class NS_COM nsGetClassObjectByContractID : public nsCOMPtr_helper
-{
-public:
- nsGetClassObjectByContractID( const char* aContractID, nsresult* aErrorPtr )
- : mContractID(aContractID),
- mErrorPtr(aErrorPtr)
- {
- // nothing else to do here
- }
-
- virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-
-private:
- const char* mContractID;
- nsresult* mErrorPtr;
-};
-
-/**
- * do_GetClassObject can be used to improve performance of callers
- * that call |CreateInstance| many times. They can cache the factory
- * and call do_CreateInstance or CallCreateInstance with the cached
- * factory rather than having the component manager retrieve it every
- * time.
- */
-inline const nsGetClassObjectByCID
-do_GetClassObject( const nsCID& aCID, nsresult* error = 0 )
-{
- return nsGetClassObjectByCID(aCID, error);
-}
-
-inline const nsGetClassObjectByContractID
-do_GetClassObject( const char* aContractID, nsresult* error = 0 )
-{
- return nsGetClassObjectByContractID(aContractID, error);
-}
-
-// type-safe shortcuts for calling |CreateInstance|
-template
-inline
-nsresult
-CallCreateInstance( const nsCID &aClass,
- nsISupports *aDelegate,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aDestination, "null parameter");
-
- return nsComponentManager::CreateInstance(aClass, aDelegate,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallCreateInstance( const nsCID &aClass,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aDestination, "null parameter");
-
- return nsComponentManager::CreateInstance(aClass, nsnull,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallCreateInstance( const char *aContractID,
- nsISupports *aDelegate,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aContractID, "null parameter");
- NS_PRECONDITION(aDestination, "null parameter");
-
- return nsComponentManager::CreateInstance(aContractID,
- aDelegate,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallCreateInstance( const char *aContractID,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aContractID, "null parameter");
- NS_PRECONDITION(aDestination, "null parameter");
-
- return nsComponentManager::CreateInstance(aContractID, nsnull,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallCreateInstance( nsIFactory *aFactory,
- nsISupports *aDelegate,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aFactory, "null parameter");
- NS_PRECONDITION(aDestination, "null parameter");
-
- return aFactory->CreateInstance(aDelegate,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallCreateInstance( nsIFactory *aFactory,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aFactory, "null parameter");
- NS_PRECONDITION(aDestination, "null parameter");
-
- return aFactory->CreateInstance(nsnull,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallGetClassObject( const nsCID &aClass,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aDestination, "null parameter");
-
- return nsComponentManager::GetClassObject(aClass,
- NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-template
-inline
-nsresult
-CallGetClassObject( const char* aContractID,
- DestinationType** aDestination )
-{
- NS_PRECONDITION(aDestination, "null parameter");
-
- return nsComponentManager::GetClassObjectByContractID(aContractID,
- NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
-}
-
-/* keys for registry use */
-extern const char xpcomKeyName[];
-extern const char xpcomComponentsKeyName[];
-extern const char lastModValueName[];
-extern const char fileSizeValueName[];
-extern const char nativeComponentType[];
-extern const char staticComponentType[];
-
-#endif /* nsComponentManagerUtils_h__ */
-
-
diff --git a/mozilla/xpcom/components/nsIComponentManager.idl b/mozilla/xpcom/components/nsIComponentManager.idl
index 20661803e8b..c65a3718739 100644
--- a/mozilla/xpcom/components/nsIComponentManager.idl
+++ b/mozilla/xpcom/components/nsIComponentManager.idl
@@ -106,6 +106,5 @@ interface nsIComponentManager : nsISupports
%{ C++
#ifndef MOZILLA_STRICT_API
#include "nsComponentManagerUtils.h"
-#include "nsComponentManagerObsolete.h"
#endif
%} C++
diff --git a/mozilla/xpcom/components/nsIComponentManagerUtils.h b/mozilla/xpcom/components/nsIComponentManagerUtils.h
deleted file mode 100644
index a21ee7e33a4..00000000000
--- a/mozilla/xpcom/components/nsIComponentManagerUtils.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 XPCOM.
- *
- * 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 of 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 MPL, 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 MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsIComponentManagerUtils_h__
-#define nsIComponentManagerUtils_h__
-
-
-
-#endif
diff --git a/mozilla/xpcom/components/nsStaticComponentLoader.cpp b/mozilla/xpcom/components/nsStaticComponentLoader.cpp
index 1996b74fdb7..b9fd6e4979c 100644
--- a/mozilla/xpcom/components/nsStaticComponentLoader.cpp
+++ b/mozilla/xpcom/components/nsStaticComponentLoader.cpp
@@ -42,6 +42,8 @@
#include NEW_H
#include
+extern const char staticComponentType[];
+
struct StaticModuleInfo : public PLDHashEntryHdr {
nsStaticModuleInfo info;
nsCOMPtr module;
diff --git a/mozilla/xpcom/glue/nsComponentManagerUtils.cpp b/mozilla/xpcom/glue/nsComponentManagerUtils.cpp
index 42ffafa7d0f..890642b2354 100644
--- a/mozilla/xpcom/glue/nsComponentManagerUtils.cpp
+++ b/mozilla/xpcom/glue/nsComponentManagerUtils.cpp
@@ -45,20 +45,111 @@
#include "nsComponentManagerUtils.h"
#include "nsIServiceManagerUtils.h"
+#include "nsIFactory.h"
+
+#ifdef MOZILLA_STRICT_API
nsresult
-nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
+CallCreateInstance(const nsCID &aCID, nsISupports *aDelegate,
+ const nsIID &aIID, void **aResult)
{
nsCOMPtr compMgr;
nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
if (compMgr)
- status = compMgr->CreateInstance(mCID, mOuter, aIID, aInstancePtr);
- else if (NS_SUCCEEDED(status))
- status = NS_ERROR_UNEXPECTED;
+ status = compMgr->CreateInstance(aCID, aDelegate, aIID, aResult);
+ return status;
+}
+nsresult
+CallCreateInstance(const char *aContractID, nsISupports *aDelegate,
+ const nsIID &aIID, void **aResult)
+{
+ nsCOMPtr compMgr;
+ nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
+ if (compMgr)
+ status = compMgr->CreateInstanceByContractID(aContractID, aDelegate,
+ aIID, aResult);
+ return status;
+}
+
+nsresult
+CallGetClassObject(const nsCID &aCID, const nsIID &aIID, void **aResult)
+{
+ nsCOMPtr compMgr;
+ nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
+ if (compMgr)
+ status = compMgr->GetClassObject(aCID, aIID, aResult);
+ return status;
+}
+
+nsresult
+CallGetClassObject(const char *aContractID, const nsIID &aIID, void **aResult)
+{
+ nsCOMPtr compMgr;
+ nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
+ if (compMgr)
+ status = compMgr->GetClassObjectByContractID(aContractID, aIID,
+ aResult);
+ return status;
+}
+
+#else
+
+#include "nsComponentManager.h"
+
+nsresult
+CallCreateInstance(const nsCID &aCID, nsISupports *aDelegate,
+ const nsIID &aIID, void **aResult)
+{
+ nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
+ NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
+
+ return compMgr->
+ nsComponentManagerImpl::CreateInstance(aCID, aDelegate, aIID, aResult);
+}
+
+nsresult
+CallCreateInstance(const char *aContractID, nsISupports *aDelegate,
+ const nsIID &aIID, void **aResult)
+{
+ nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
+ NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
+
+ return compMgr->
+ nsComponentManagerImpl::CreateInstanceByContractID(aContractID,
+ aDelegate, aIID,
+ aResult);
+}
+
+nsresult
+CallGetClassObject(const nsCID &aCID, const nsIID &aIID, void **aResult)
+{
+ nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
+ NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
+
+ return compMgr->
+ nsComponentManagerImpl::GetClassObject(aCID, aIID, aResult);
+}
+
+nsresult
+CallGetClassObject(const char *aContractID, const nsIID &aIID, void **aResult)
+{
+ nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
+ NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
+
+ return compMgr->
+ nsComponentManagerImpl::GetClassObjectByContractID(aContractID, aIID,
+ aResult);
+}
+
+#endif
+
+nsresult
+nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
+{
+ nsresult status = CallCreateInstance(mCID, mOuter, aIID, aInstancePtr);
if ( NS_FAILED(status) )
*aInstancePtr = 0;
-
if ( mErrorPtr )
*mErrorPtr = status;
return status;
@@ -67,19 +158,7 @@ nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) cons
nsresult
nsCreateInstanceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const
{
- nsresult status;
- if ( mContractID ) {
- nsCOMPtr compMgr;
- status = NS_GetComponentManager(getter_AddRefs(compMgr));
- if (compMgr)
- status = compMgr->CreateInstanceByContractID(mContractID, mOuter,
- aIID, aInstancePtr);
- else if (NS_SUCCEEDED(status))
- status = NS_ERROR_UNEXPECTED;
- }
- else
- status = NS_ERROR_NULL_POINTER;
-
+ nsresult status = CallCreateInstance(mContractID, mOuter, aIID, aInstancePtr);
if (NS_FAILED(status))
*aInstancePtr = 0;
if ( mErrorPtr )
@@ -90,12 +169,7 @@ nsCreateInstanceByContractID::operator()( const nsIID& aIID, void** aInstancePtr
nsresult
nsCreateInstanceFromFactory::operator()( const nsIID& aIID, void** aInstancePtr ) const
{
- nsresult status;
- if ( mFactory )
- status = mFactory->CreateInstance(mOuter, aIID, aInstancePtr);
- else
- status = NS_ERROR_NULL_POINTER;
-
+ nsresult status = mFactory->CreateInstance(mOuter, aIID, aInstancePtr);
if ( NS_FAILED(status) )
*aInstancePtr = 0;
if ( mErrorPtr )
@@ -107,16 +181,9 @@ nsCreateInstanceFromFactory::operator()( const nsIID& aIID, void** aInstancePtr
nsresult
nsGetClassObjectByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
{
- nsCOMPtr compMgr;
- nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
- if (compMgr)
- status = compMgr->GetClassObject(mCID, aIID, aInstancePtr);
- else if (NS_SUCCEEDED(status))
- status = NS_ERROR_UNEXPECTED;
-
+ nsresult status = CallGetClassObject(mCID, aIID, aInstancePtr);
if ( NS_FAILED(status) )
*aInstancePtr = 0;
-
if ( mErrorPtr )
*mErrorPtr = status;
return status;
@@ -125,19 +192,7 @@ nsGetClassObjectByCID::operator()( const nsIID& aIID, void** aInstancePtr ) cons
nsresult
nsGetClassObjectByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const
{
- nsresult status;
- if ( mContractID ) {
- nsCOMPtr compMgr;
- status = NS_GetComponentManager(getter_AddRefs(compMgr));
- if (compMgr)
- status = compMgr->GetClassObjectByContractID(mContractID,
- aIID, aInstancePtr);
- else if (NS_SUCCEEDED(status))
- status = NS_ERROR_UNEXPECTED;
- }
- else
- status = NS_ERROR_NULL_POINTER;
-
+ nsresult status = CallGetClassObject(mContractID, aIID, aInstancePtr);
if ( NS_FAILED(status) )
*aInstancePtr = 0;
if ( mErrorPtr )
@@ -190,6 +245,3 @@ nsGetServiceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) c
*mErrorPtr = status;
return status;
}
-
-
-
diff --git a/mozilla/xpcom/glue/nsComponentManagerUtils.h b/mozilla/xpcom/glue/nsComponentManagerUtils.h
index 9eb9418ea0d..b7c5f2fd7a4 100644
--- a/mozilla/xpcom/glue/nsComponentManagerUtils.h
+++ b/mozilla/xpcom/glue/nsComponentManagerUtils.h
@@ -38,26 +38,35 @@
#ifndef nsComponentManagerUtils_h__
#define nsComponentManagerUtils_h__
-/*
- * Do not include this file directly. Instead,
- * |#include "nsIComponentManager.h"|.
- */
+#ifndef nscore_h__
+#include "nscore.h"
+#endif
#ifndef nsCOMPtr_h__
#include "nsCOMPtr.h"
#endif
-#ifndef nsComponentManagerObsolete_h___
-#include "nsComponentManagerObsolete.h"
-#endif
+class nsIFactory;
+
+
+NS_COM_GLUE nsresult
+CallCreateInstance
+ (const nsCID &aClass, nsISupports *aDelegate, const nsIID &aIID,
+ void **aResult);
+
+NS_COM_GLUE nsresult
+CallCreateInstance
+ (const char *aContractID, nsISupports *aDelegate, const nsIID &aIID,
+ void **aResult);
+
+NS_COM_GLUE nsresult
+CallGetClassObject
+ (const nsCID &aClass, const nsIID &aIID, void **aResult);
+
+NS_COM_GLUE nsresult
+CallGetClassObject
+ (const char *aContractID, const nsIID &aIID, void **aResult);
-#define NS_COMPONENTMANAGER_CID \
-{ /* 91775d60-d5dc-11d2-92fb-00e09805570f */ \
- 0x91775d60, \
- 0xd5dc, \
- 0x11d2, \
- {0x92, 0xfb, 0x00, 0xe0, 0x98, 0x05, 0x57, 0x0f} \
-}
class NS_COM nsCreateInstanceByCID : public nsCOMPtr_helper
{
@@ -223,9 +232,9 @@ CallCreateInstance( const nsCID &aClass,
{
NS_PRECONDITION(aDestination, "null parameter");
- return nsComponentManager::CreateInstance(aClass, aDelegate,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
+ return CallCreateInstance(aClass, aDelegate,
+ NS_GET_IID(DestinationType),
+ NS_REINTERPRET_CAST(void**, aDestination));
}
template
@@ -236,9 +245,9 @@ CallCreateInstance( const nsCID &aClass,
{
NS_PRECONDITION(aDestination, "null parameter");
- return nsComponentManager::CreateInstance(aClass, nsnull,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
+ return CallCreateInstance(aClass, nsnull,
+ NS_GET_IID(DestinationType),
+ NS_REINTERPRET_CAST(void**, aDestination));
}
template
@@ -251,10 +260,10 @@ CallCreateInstance( const char *aContractID,
NS_PRECONDITION(aContractID, "null parameter");
NS_PRECONDITION(aDestination, "null parameter");
- return nsComponentManager::CreateInstance(aContractID,
- aDelegate,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
+ return CallCreateInstance(aContractID,
+ aDelegate,
+ NS_GET_IID(DestinationType),
+ NS_REINTERPRET_CAST(void**, aDestination));
}
template
@@ -266,9 +275,9 @@ CallCreateInstance( const char *aContractID,
NS_PRECONDITION(aContractID, "null parameter");
NS_PRECONDITION(aDestination, "null parameter");
- return nsComponentManager::CreateInstance(aContractID, nsnull,
- NS_GET_IID(DestinationType),
- NS_REINTERPRET_CAST(void**, aDestination));
+ return CallCreateInstance(aContractID, nsnull,
+ NS_GET_IID(DestinationType),
+ NS_REINTERPRET_CAST(void**, aDestination));
}
template
@@ -308,7 +317,7 @@ CallGetClassObject( const nsCID &aClass,
{
NS_PRECONDITION(aDestination, "null parameter");
- return nsComponentManager::GetClassObject(aClass,
+ return CallGetClassObject(aClass,
NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}
@@ -320,18 +329,8 @@ CallGetClassObject( const char* aContractID,
{
NS_PRECONDITION(aDestination, "null parameter");
- return nsComponentManager::GetClassObjectByContractID(aContractID,
+ return CallGetClassObject(aContractID,
NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}
-/* keys for registry use */
-extern const char xpcomKeyName[];
-extern const char xpcomComponentsKeyName[];
-extern const char lastModValueName[];
-extern const char fileSizeValueName[];
-extern const char nativeComponentType[];
-extern const char staticComponentType[];
-
#endif /* nsComponentManagerUtils_h__ */
-
-
diff --git a/mozilla/xpcom/glue/objs.mk b/mozilla/xpcom/glue/objs.mk
index d6d04a5ac62..98ab1c6f798 100644
--- a/mozilla/xpcom/glue/objs.mk
+++ b/mozilla/xpcom/glue/objs.mk
@@ -53,6 +53,7 @@ XPCOM_GLUE_SRC_LEXPORTS = \
nsMemory.h \
nsTraceRefcnt.h \
nsWeakReference.h \
+ nsComponentManagerUtils.h \
$(NULL)