Bug 394139: Replace a bunch of NS_DEFINE_CIDs with CONTRACTIDs. r=/sr=/a=bsmedberg
authorjag@tty.nl
Wed, 05 Sep 2007 06:04:54 -0700
changeset 5691 05257644082d203263e28c770c50b3de3c4aae46
parent 5690 dea325e030e1fddc93e7eaf3929b20004b6dc1fd
child 5692 7ca1ff4211c184d27e2303394d63ba6163e64d44
push idunknown
push userunknown
push dateunknown
bugs394139
milestone1.9a8pre
Bug 394139: Replace a bunch of NS_DEFINE_CIDs with CONTRACTIDs. r=/sr=/a=bsmedberg
content/xul/document/src/nsXULDocument.cpp
embedding/browser/gtk/src/EmbedCertificates.cpp
embedding/minimo/chromelite/nsSimpleChromeHandler.cpp
intl/uconv/src/nsCharsetConverterManager.cpp
intl/uconv/tests/convperf.cpp
intl/uconv/tests/plattest.cpp
modules/oji/src/jvmmgr.cpp
modules/plugin/base/src/nsPluginHostImpl.cpp
netwerk/base/src/nsIOService.cpp
netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp
security/manager/boot/src/nsSecurityWarningDialogs.cpp
security/manager/pki/src/nsNSSDialogs.cpp
security/manager/ssl/src/nsNSSIOLayer.cpp
uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
uriloader/exthandler/os2/nsMIMEInfoOS2.h
widget/src/xpwidgets/nsPrintOptionsImpl.cpp
xpfe/appshell/src/nsXULWindow.cpp
xpinstall/src/nsXPInstallManager.cpp
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -129,20 +129,17 @@
 #include "nsIXULWindow.h"
 #include "nsXULPopupManager.h"
 
 //----------------------------------------------------------------------
 //
 // CIDs
 //
 
-static NS_DEFINE_CID(kLocalStoreCID,             NS_LOCALSTORE_CID);
 static NS_DEFINE_CID(kParserCID,                 NS_PARSER_CID);
-static NS_DEFINE_CID(kRDFServiceCID,             NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kXULPrototypeCacheCID,      NS_XULPROTOTYPECACHE_CID);
 
 static PRBool IsChromeURI(nsIURI* aURI)
 {
     // why is this check a member function of nsXULDocument? -gagan
     PRBool isChrome = PR_FALSE;
     if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome)
         return PR_TRUE;
     return PR_FALSE;
@@ -1845,22 +1842,22 @@ nsXULDocument::Init()
 
     // Create our command dispatcher and hook it up.
     mCommandDispatcher = new nsXULCommandDispatcher(this);
     NS_ENSURE_TRUE(mCommandDispatcher, NS_ERROR_OUT_OF_MEMORY);
 
     // this _could_ fail; e.g., if we've tried to grab the local store
     // before profiles have initialized. If so, no big deal; nothing
     // will persist.
-    mLocalStore = do_GetService(kLocalStoreCID);
+    mLocalStore = do_GetService(NS_LOCALSTORE_CONTRACTID);
 
     if (gRefCnt++ == 0) {
         // Keep the RDF service cached in a member variable to make using
         // it a bit less painful
-        rv = CallGetService(kRDFServiceCID, &gRDFService);
+        rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService);
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF Service");
         if (NS_FAILED(rv)) return rv;
 
         gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "persist"),
                                  &kNC_persist);
         gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "attribute"),
                                  &kNC_attribute);
         gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "value"),
--- a/embedding/browser/gtk/src/EmbedCertificates.cpp
+++ b/embedding/browser/gtk/src/EmbedCertificates.cpp
@@ -70,18 +70,16 @@
 #include "EmbedCertificates.h"
 #include "nsIKeygenThread.h"
 #include "nsIX509CertValidity.h"
 #include "nsICRLInfo.h"
 #include "gtkmozembed.h"
 
 #define PIPSTRING_BUNDLE_URL "chrome://pippki/locale/pippki.properties"
 
-static NS_DEFINE_CID(kCStringBundleServiceCID,  NS_STRINGBUNDLESERVICE_CID);
-
 EmbedCertificates::EmbedCertificates(void)
 {
 }
 
 EmbedCertificates::~EmbedCertificates()
 {
 }
 
@@ -100,17 +98,18 @@ NS_INTERFACE_MAP_ENTRY(nsITokenDialogs)
 NS_INTERFACE_MAP_ENTRY(nsIGeneratingKeypairInfoDialogs)
 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCryptoDialogs)
 NS_INTERFACE_MAP_END
 
 nsresult
 EmbedCertificates::Init(void)
 {
   nsresult rv;
-  nsCOMPtr<nsIStringBundleService> service = do_GetService(kCStringBundleServiceCID, &rv);
+  nsCOMPtr<nsIStringBundleService> service =
+           do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return NS_OK;
   rv = service->CreateBundle(PIPSTRING_BUNDLE_URL,
                              getter_AddRefs(mPIPStringBundle));
   return NS_OK;
 }
 
 nsresult
 EmbedCertificates::SetPassword(nsIInterfaceRequestor *ctx,
--- a/embedding/minimo/chromelite/nsSimpleChromeHandler.cpp
+++ b/embedding/minimo/chromelite/nsSimpleChromeHandler.cpp
@@ -83,18 +83,17 @@ nsresult
 nsSimpleChromeURL::Init(PRUint32 urlType,
                     PRInt32 defaultPort,
                     const nsACString &spec,
                     const char *charset,
                     nsIURI *baseURI)
 
 {
   nsresult rv;
-  static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);    
-  mStandardURL = do_CreateInstance(kStandardURLCID, &rv);
+  mStandardURL = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
   NS_ASSERTION(mStandardURL, "Could not create a Standard URL");
   
   if (NS_FAILED(rv)) return rv;
 
   nsCOMPtr<nsIStandardURL> surl = do_QueryInterface(mStandardURL);
   return surl->Init(urlType, defaultPort, spec, charset, baseURI);
 }
 
@@ -166,18 +165,16 @@ nsSimpleChromeHandler::GetDefaultPort(PR
 
 NS_IMETHODIMP
 nsSimpleChromeHandler::GetProtocolFlags(PRUint32 *result)
 {
     *result = URI_STD | URI_IS_UI_RESOURCE;
     return NS_OK;
 }
 
-static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
-
 NS_IMETHODIMP
 nsSimpleChromeHandler::NewURI(const nsACString &aSpec,
                              const char *aCharset,
                              nsIURI *aBaseURI,
                              nsIURI **result)
 
 {
     nsresult rv;
--- a/intl/uconv/src/nsCharsetConverterManager.cpp
+++ b/intl/uconv/src/nsCharsetConverterManager.cpp
@@ -51,26 +51,23 @@
 #include "prmem.h"
 #include "nsCRT.h"
 #include "nsVoidArray.h"
 #include "nsStringEnumerator.h"
 
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 
-// just for CIDs
+// just for CONTRACTIDs
 #include "nsCharsetConverterManager.h"
 
 #ifdef MOZ_USE_NATIVE_UCONV
 #include "nsNativeUConvService.h"
 #endif
 
-static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
-static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
-
 // Pattern of cached, commonly used, single byte decoder
 #define NS_1BYTE_CODER_PATTERN "ISO-8859"
 #define NS_1BYTE_CODER_PATTERN_LEN 8
 
 // Class nsCharsetConverterManager [implementation]
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsCharsetConverterManager,
                               nsICharsetConverterManager)
@@ -116,17 +113,17 @@ nsCharsetConverterManager::RegisterConve
 
 nsresult nsCharsetConverterManager::LoadExtensibleBundle(
                                     const char* aCategory, 
                                     nsIStringBundle ** aResult)
 {
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIStringBundleService> sbServ = 
-           do_GetService(kStringBundleServiceCID, &rv);
+           do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   if (NS_FAILED(rv))
     return rv;
 
   return sbServ->CreateExtensibleBundle(aCategory, aResult);
 }
 
 nsresult nsCharsetConverterManager::GetBundleValue(nsIStringBundle * aBundle, 
                                                    const char * aName, 
@@ -367,17 +364,17 @@ nsCharsetConverterManager::GetCharsetAli
 {
   NS_PRECONDITION(aCharset, "null param");
   if (!aCharset)
     return NS_ERROR_NULL_POINTER;
 
   // We try to obtain the preferred name for this charset from the charset 
   // aliases. If we don't get it from there, we just use the original string
   nsDependentCString charset(aCharset);
-  nsCOMPtr<nsICharsetAlias> csAlias( do_GetService(kCharsetAliasCID) );
+  nsCOMPtr<nsICharsetAlias> csAlias(do_GetService(NS_CHARSETALIAS_CONTRACTID));
   NS_ASSERTION(csAlias, "failed to get the CharsetAlias service");
   if (csAlias) {
     nsAutoString pref;
     nsresult rv = csAlias->GetPreferred(charset, aResult);
     if (NS_SUCCEEDED(rv)) {
       return (!aResult.IsEmpty()) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
     }
   }
--- a/intl/uconv/tests/convperf.cpp
+++ b/intl/uconv/tests/convperf.cpp
@@ -38,18 +38,16 @@
 #include <winnls.h>
 
 #include "nscore.h"
 #include "nsString.h"
 #include "nsIServiceManager.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIUnicodeEncoder.h"
 #include "nsIUnicodeDecoder.h"
-static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
-static NS_DEFINE_IID(kICharsetConverterManagerIID, NS_ICHARSETCONVERTERMANAGER_IID);
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 void usage()
 {
   printf(
 "convperf -f fromcode -t tocode [file]\n"
@@ -109,17 +107,17 @@ void msEncode(UINT cp, const PRUnichar *
    if(*destLen <= 0)
       fprintf(stderr, "problem in ::WideCharToMultiByte\n");
 }
      
 int main(int argc, const char** argv)
 {
    nsresult res;
    nsCOMPtr<nsICharsetConverterManager> ccMain =
-      do_GetService(kCharsetConverterManagerCID, &res);
+      do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
    if(NS_FAILED(res))
    {
 	 fprintf(stderr, "Cannot get Character Converter Manager %x\n", res);
    }
    int i;
    if(argc > 5)
    {
      for(i =0; i < argc; i++)
--- a/intl/uconv/tests/plattest.cpp
+++ b/intl/uconv/tests/plattest.cpp
@@ -37,30 +37,26 @@
 #include "nsIPlatformCharset.h"
 #include "nsILocaleService.h"
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsLocaleCID.h"
 #include "nsIComponentManager.h"
 #include <stdio.h>
 
-NS_DEFINE_IID(kLocaleServiceIID,NS_ILOCALESERVICE_IID);
-NS_DEFINE_CID(kLocaleServiceCID,NS_LOCALESERVICE_CID);
-NS_DEFINE_IID(kPlatformCharsetIID,NS_IPLATFORMCHARSET_IID);
-
 int
 main(int argc, const char** argv)
 {
 
     nsCOMPtr<nsIPlatformCharset> platform_charset = 
         do_CreateInstance(NS_PLATFORMCHARSET_CONTRACTID);
     if (!platform_charset) return -1;
 
     nsCOMPtr<nsILocaleService>      locale_service = 
-        do_CreateInstance(kLocaleServiceCID);
+        do_CreateInstance(NS_LOCALESERVICE_CONTRACTID);
     if (!locale_service) return -1;
 
     nsCOMPtr<nsILocale>             locale;
     nsCAutoString                   charset;
     nsAutoString                    category;
 
     nsresult rv = locale_service->GetSystemLocale(getter_AddRefs(locale));
     if (NS_FAILED(rv)) return -1;
--- a/modules/oji/src/jvmmgr.cpp
+++ b/modules/oji/src/jvmmgr.cpp
@@ -39,17 +39,17 @@
 #include "nsJVMManager.h"
 #include "nsIServiceManager.h"
 #include "nsIJVMPrefsWindow.h"
 #include "ProxyJNI.h"
 #include "lcglue.h"
 #include "nsCSecurityContext.h"
 #include "nsIJSContextStack.h"
 
-static NS_DEFINE_CID(kJVMManagerCID, NS_JVMMANAGER_CID);
+#define NS_JVMMANAGER_CONTRACTID "@mozilla.org/oji/jvm-mgr;1"
 static NS_DEFINE_IID(kIJVMConsoleIID, NS_IJVMCONSOLE_IID);
 static NS_DEFINE_IID(kIJVMPrefsWindowIID, NS_IJVMPREFSWINDOW_IID);
 static NS_DEFINE_IID(kISymantecDebuggerIID, NS_ISYMANTECDEBUGGER_IID);
 
 PR_BEGIN_EXTERN_C
 
 #ifdef PRE_SERVICE_MANAGER
 extern nsPluginManager* thePluginManager;
@@ -61,17 +61,17 @@ JVM_ReleaseJVMMgr(nsJVMManager* mgr)
     mgr->Release();
 }
 
 static nsIJVMPlugin*
 GetRunningJVM(void)
 {
     nsIJVMPlugin* jvm = NULL;
     nsresult rv;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return jvm;
     nsJVMManager* jvmMgr = (nsJVMManager *)managerService.get();  
     if (jvmMgr) {
         nsJVMStatus status = jvmMgr->GetJVMStatus();
         if (status == nsJVMStatus_Enabled)
             status = jvmMgr->StartupJVM();
         if (status == nsJVMStatus_Running) {
             jvm = jvmMgr->GetJVMPlugin();
@@ -87,45 +87,45 @@ JVM_StartupJVM(void)
     return JVM_GetJVMStatus();
 }
 
 PR_IMPLEMENT(nsJVMStatus)
 JVM_ShutdownJVM(void)
 {
     nsJVMStatus status = nsJVMStatus_Failed;
     nsresult rv;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return status;
     nsJVMManager* mgr = (nsJVMManager *)managerService.get();  
     if (mgr) {
         status = mgr->ShutdownJVM();
     }
     return status;
 }
 
 
 PR_IMPLEMENT(nsJVMStatus)
 JVM_GetJVMStatus(void)
 {
     nsresult rv;
     nsJVMStatus status = nsJVMStatus_Disabled;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return status;
     nsJVMManager* mgr = (nsJVMManager *)managerService.get();  
     if (mgr) {
         status = mgr->GetJVMStatus();
     }
     return status;
 }
 
 PR_IMPLEMENT(PRBool)
 JVM_AddToClassPath(const char* dirPath)
 {
     nsresult err = NS_ERROR_FAILURE;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &err);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &err);
     if (NS_FAILED(err)) return PR_FALSE;
     nsJVMManager* mgr = (nsJVMManager *)managerService.get();
     if (mgr) {
         err = mgr->AddToClassPath(dirPath);
     }
     return err == NS_OK;
 }
 
@@ -317,46 +317,46 @@ JVM_SpendTime(PRUint32 timeMillis)
 #endif
 }
 
 PR_IMPLEMENT(PRBool)
 JVM_MaybeStartupLiveConnect()
 {
     PRBool result = PR_FALSE;
     nsresult rv;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return result;
     nsJVMManager* mgr = (nsJVMManager *)managerService.get();  
     if (mgr) {
         result = mgr->MaybeStartupLiveConnect();
     }
     return result;
 }
 
 
 PR_IMPLEMENT(PRBool)
 JVM_MaybeShutdownLiveConnect(void)
 {
     PRBool result = PR_FALSE;
     nsresult rv;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return result;
     nsJVMManager* mgr = (nsJVMManager *)managerService.get(); 
     if (mgr) {
         result = mgr->MaybeShutdownLiveConnect();
     }
     return result;
 }
 
 PR_IMPLEMENT(PRBool)
 JVM_IsLiveConnectEnabled(void)
 {
     PRBool result = PR_FALSE;
     nsresult rv;
-    nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
+    nsCOMPtr<nsIJVMManager> managerService = do_GetService(NS_JVMMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return result;
     nsJVMManager* mgr = (nsJVMManager *)managerService.get();
     if (mgr) {
         result = mgr->IsLiveConnectEnabled();
     }
     return result;
 }
 
--- a/modules/plugin/base/src/nsPluginHostImpl.cpp
+++ b/modules/plugin/base/src/nsPluginHostImpl.cpp
@@ -206,17 +206,16 @@ static const char *kPluginRegistryVersio
 static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
 static NS_DEFINE_IID(kIPluginInstancePeerIID, NS_IPLUGININSTANCEPEER_IID);
 static NS_DEFINE_IID(kIPluginStreamInfoIID, NS_IPLUGINSTREAMINFO_IID);
 static NS_DEFINE_CID(kPluginCID, NS_PLUGIN_CID);
 static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
 static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
 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(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
 
 ////////////////////////////////////////////////////////////////////////
 // Registry keys for caching plugin info
 static const char kPluginsRootKey[] = "software/plugins";
 static const char kPluginsNameKey[] = "name";
 static const char kPluginsDescKey[] = "description";
 static const char kPluginsFilenameKey[] = "filename";
@@ -6477,17 +6476,17 @@ nsPluginHostImpl::HandleBadPlugin(PRLibr
       nsCOMPtr<nsPIPluginInstancePeer> privpeer(do_QueryInterface(peer));
       privpeer->GetOwner(getter_AddRefs(owner));
     }
   }
 
   nsCOMPtr<nsIPrompt> prompt;
   GetPrompt(owner, getter_AddRefs(prompt));
   if (prompt) {
-    nsCOMPtr<nsIStringBundleService> strings(do_GetService(kStringBundleServiceCID, &rv));
+    nsCOMPtr<nsIStringBundleService> strings(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
     if (NS_FAILED(rv))
       return rv;
 
     nsCOMPtr<nsIStringBundle> bundle;
     rv = strings->CreateBundle(BRAND_PROPERTIES_URL, getter_AddRefs(bundle));
     if (NS_FAILED(rv))
       return rv;
 
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -76,22 +76,16 @@
 #endif
 
 #define PORT_PREF_PREFIX     "network.security.ports."
 #define PORT_PREF(x)         PORT_PREF_PREFIX x
 #define AUTODIAL_PREF        "network.autodial-helper.enabled"
 
 #define MAX_RECURSION_COUNT 50
 
-static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
-static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
-static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
-static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
-static NS_DEFINE_CID(kProtocolProxyServiceCID, NS_PROTOCOLPROXYSERVICE_CID);
-
 nsIOService* gIOService = nsnull;
 
 // A general port blacklist.  Connections to these ports will not be allowed unless 
 // the protocol overrides.
 //
 // TODO: I am sure that there are more ports to be added.  
 //       This cut is based on the classic mozilla codebase
 
@@ -197,30 +191,30 @@ nsIOService::Init()
     nsresult rv;
     
     // We need to get references to these services so that we can shut them
     // down later. If we wait until the nsIOService is being shut down,
     // GetService will fail at that point.
 
     // TODO(darin): Load the Socket and DNS services lazily.
 
-    mSocketTransportService = do_GetService(kSocketTransportServiceCID, &rv);
+    mSocketTransportService = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) {
         NS_WARNING("failed to get socket transport service");
         return rv;
     }
 
-    mDNSService = do_GetService(kDNSServiceCID, &rv);
+    mDNSService = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) {
         NS_WARNING("failed to get DNS service");
         return rv;
     }
 
     // XXX hack until xpidl supports error info directly (bug 13423)
-    nsCOMPtr<nsIErrorService> errorService = do_GetService(kErrorServiceCID);
+    nsCOMPtr<nsIErrorService> errorService = do_GetService(NS_ERRORSERVICE_CONTRACTID);
     if (errorService) {
         errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_NETWORK, NECKO_MSGS_URL);
     }
     else
         NS_WARNING("failed to get error service");
     
     // setup our bad port list stuff
     for(int i=0; gBadPortList[i]; i++)
--- a/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp
+++ b/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp
@@ -83,19 +83,16 @@ PRLogModuleInfo* gFTPLog = nsnull;
 #endif
 #define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args)
 
 //-----------------------------------------------------------------------------
 
 #define IDLE_TIMEOUT_PREF     "network.ftp.idleConnectionTimeout"
 #define IDLE_CONNECTION_LIMIT 8 /* TODO pref me */
 
-static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
-static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);
-
 nsFtpProtocolHandler *gFtpHandler = nsnull;
 
 //-----------------------------------------------------------------------------
 
 nsFtpProtocolHandler::nsFtpProtocolHandler()
     : mIdleTimeout(-1)
 {
 #if defined(PR_LOGGING)
@@ -192,17 +189,17 @@ nsFtpProtocolHandler::NewURI(const nsACS
     // spec knows its new length.
     spec.Truncate(len);
 
     // return an error if we find a NUL, CR, or LF in the path
     if (spec.FindCharInSet(CRLF) >= 0 || spec.FindChar('\0') >= 0)
         return NS_ERROR_MALFORMED_URI;
 
     nsresult rv;
-    nsCOMPtr<nsIStandardURL> url = do_CreateInstance(kStandardURLCID, &rv);
+    nsCOMPtr<nsIStandardURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return rv;
 
     rv = url->Init(nsIStandardURL::URLTYPE_AUTHORITY, 21, aSpec, aCharset, aBaseURI);
     if (NS_FAILED(rv)) return rv;
 
     return CallQueryInterface(url, result);
 }
 
--- a/security/manager/boot/src/nsSecurityWarningDialogs.cpp
+++ b/security/manager/boot/src/nsSecurityWarningDialogs.cpp
@@ -46,18 +46,16 @@
 #include "nsIPrompt.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsSecurityWarningDialogs, nsISecurityWarningDialogs)
 
-static NS_DEFINE_CID(kCStringBundleServiceCID,  NS_STRINGBUNDLESERVICE_CID);
-
 #define STRING_BUNDLE_URL    "chrome://pipnss/locale/security.properties"
 
 #define ENTER_SITE_PREF      "security.warn_entering_secure"
 #define WEAK_SITE_PREF       "security.warn_entering_weak"
 #define LEAVE_SITE_PREF      "security.warn_leaving_secure"
 #define MIXEDCONTENT_PREF    "security.warn_viewing_mixed"
 #define INSECURE_SUBMIT_PREF "security.warn_submit_insecure"
 
@@ -72,17 +70,18 @@ nsSecurityWarningDialogs::~nsSecurityWar
 nsresult
 nsSecurityWarningDialogs::Init()
 {
   nsresult rv;
 
   mPrefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
-  nsCOMPtr<nsIStringBundleService> service = do_GetService(kCStringBundleServiceCID, &rv);
+  nsCOMPtr<nsIStringBundleService> service =
+           do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
   
   rv = service->CreateBundle(STRING_BUNDLE_URL,
                              getter_AddRefs(mStringBundle));
   return rv;
 }
 
 NS_IMETHODIMP 
--- a/security/manager/pki/src/nsNSSDialogs.cpp
+++ b/security/manager/pki/src/nsNSSDialogs.cpp
@@ -63,20 +63,17 @@
 #include "nsPKIParamBlock.h"
 #include "nsIKeygenThread.h"
 #include "nsNSSDialogHelper.h"
 #include "nsIX509CertValidity.h"
 #include "nsICRLInfo.h"
 
 #define PIPSTRING_BUNDLE_URL "chrome://pippki/locale/pippki.properties"
 
-static NS_DEFINE_CID(kCStringBundleServiceCID,  NS_STRINGBUNDLESERVICE_CID);
-
 /* ==== */
-static NS_DEFINE_CID(kPKIParamBlockCID, NS_PKIPARAMBLOCK_CID);
 
 nsNSSDialogs::nsNSSDialogs()
 {
 }
 
 nsNSSDialogs::~nsNSSDialogs()
 {
 }
@@ -90,17 +87,18 @@ NS_IMPL_THREADSAFE_ISUPPORTS8(nsNSSDialo
                                             nsIDOMCryptoDialogs,
                                             nsIGeneratingKeypairInfoDialogs)
 
 nsresult
 nsNSSDialogs::Init()
 {
   nsresult rv;
 
-  nsCOMPtr<nsIStringBundleService> service = do_GetService(kCStringBundleServiceCID, &rv);
+  nsCOMPtr<nsIStringBundleService> service =
+           do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
   
   rv = service->CreateBundle(PIPSTRING_BUNDLE_URL,
                              getter_AddRefs(mPIPStringBundle));
   return rv;
 }
 
 nsresult
@@ -109,17 +107,18 @@ nsNSSDialogs::SetPassword(nsIInterfaceRe
 {
   nsresult rv;
 
   *_canceled = PR_FALSE;
 
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
 
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   // void ChangePassword(in wstring tokenName, out int status);
   rv = block->SetString(1, tokenName);
   if (NS_FAILED(rv)) return rv;
 
   rv = nsNSSDialogHelper::openDialog(parent,
                                 "chrome://pippki/content/changepassword.xul",
@@ -142,17 +141,18 @@ nsNSSDialogs::GetPassword(nsIInterfaceRe
                           const PRUnichar *tokenName, 
                           PRUnichar **_password,
                           PRBool* _canceled)
 {
   nsresult rv;
   *_canceled = PR_FALSE;
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block = 
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
   // Set the token name in the window
   rv = block->SetString(1, tokenName);
   if (NS_FAILED(rv)) return rv;
   // open up the window
   rv = nsNSSDialogHelper::openDialog(parent,
                                      "chrome://pippki/content/getpassword.xul",
                                      block);
@@ -174,17 +174,18 @@ nsNSSDialogs::ConfirmUnknownIssuer(nsIIn
                                    nsIX509Cert *cert, PRInt16 *outAddType,
                                    PRBool *_retval)
 {
   nsresult rv;
   PRInt32 addType;
   
   *_retval = PR_FALSE;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
 
   if (!block)
     return NS_ERROR_FAILURE;
 
   nsXPIDLString commonName;
   rv = block->SetISupportAtIndex(1, cert);
   if (NS_FAILED(rv))
     return rv;
@@ -231,17 +232,18 @@ NS_IMETHODIMP
 nsNSSDialogs::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, 
                                     const nsACString &targetURL, 
                                     nsIX509Cert *cert, PRBool *_retval) 
 {
   nsresult rv;
 
   *_retval = PR_FALSE;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
 
   if (!block)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIDialogParamBlock> dialogBlock = do_QueryInterface(block);
   rv = dialogBlock->SetString(1, NS_ConvertUTF8toUTF16(targetURL).get());
   if (NS_FAILED(rv))
     return rv;
@@ -275,17 +277,18 @@ nsNSSDialogs::ConfirmCertExpired(nsIInte
   PRTime now = PR_Now();
   PRTime notAfter, notBefore, timeToUse;
   nsCOMPtr<nsIX509CertValidity> validity;
   const char *key;
   const char *titleKey;
 
   *_retval = PR_FALSE;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
 
   if (!block)
     return NS_ERROR_FAILURE; 
   rv = cert->GetValidity(getter_AddRefs(validity));
   if (NS_FAILED(rv))
     return rv;
 
   rv = validity->GetNotAfter(&notAfter);
@@ -353,17 +356,18 @@ nsNSSDialogs::ConfirmCertExpired(nsIInte
 }
 
 NS_IMETHODIMP 
 nsNSSDialogs::NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, 
                                   const nsACString &targetURL, nsIX509Cert *cert)
 {
   nsresult rv;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
   nsCOMPtr<nsIDialogParamBlock> dialogBlock = do_QueryInterface(block);
 
   rv = dialogBlock->SetString(1, NS_ConvertUTF8toUTF16(targetURL).get());
   if (NS_FAILED(rv))
     return rv;
 
   rv = block->SetISupportAtIndex(1, cert);
   if (NS_FAILED(rv))
@@ -375,17 +379,18 @@ nsNSSDialogs::NotifyCrlNextupdate(nsIInt
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsNSSDialogs::CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl)
 {
   nsresult rv;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID,&rv);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID,&rv);
   if (NS_FAILED(rv))
     return rv;
   
   rv = block->SetISupportAtIndex(1, crl);
   if (NS_FAILED(rv))
     return rv;
 
   rv = nsNSSDialogHelper::openDialog(nsnull,
@@ -402,17 +407,18 @@ nsNSSDialogs::ConfirmDownloadCACert(nsII
 {
   nsresult rv;
 
   *_retval = PR_TRUE;
 
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
   if (!block)
     return NS_ERROR_FAILURE;
 
   rv = block->SetISupportAtIndex(1, cert);
   if (NS_FAILED(rv))
     return rv;
 
   rv = nsNSSDialogHelper::openDialog(parent, 
@@ -448,17 +454,18 @@ nsNSSDialogs::ConfirmDownloadCACert(nsII
 NS_IMETHODIMP 
 nsNSSDialogs::NotifyCACertExists(nsIInterfaceRequestor *ctx)
 {
   nsresult rv;
 
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
 
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   
   rv = nsNSSDialogHelper::openDialog(parent, 
                                      "chrome://pippki/content/cacertexists.xul",
                                      block);
 
   return rv;
@@ -471,17 +478,18 @@ nsNSSDialogs::ChooseCertificate(nsIInter
   nsresult rv;
   PRUint32 i;
 
   *canceled = PR_FALSE;
 
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
 
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   block->SetNumberStrings(4+count*2);
 
   rv = block->SetString(0, cn);
   if (NS_FAILED(rv)) return rv;
 
   rv = block->SetString(1, organization);
@@ -533,17 +541,18 @@ nsNSSDialogs::PickCertificate(nsIInterfa
   nsresult rv;
   PRUint32 i;
 
   *canceled = PR_FALSE;
 
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
 
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   block->SetNumberStrings(1+count*2);
 
   for (i = 0; i < count; i++) {
     rv = block->SetString(i, certNickList[i]);
     if (NS_FAILED(rv)) return rv;
   }
@@ -581,17 +590,18 @@ NS_IMETHODIMP
 nsNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, 
                                     nsAString &_password,
                                     PRBool *_retval)
 {
   nsresult rv;
   *_retval = PR_TRUE;
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
   // open up the window
   rv = nsNSSDialogHelper::openDialog(parent,
                                   "chrome://pippki/content/setp12password.xul",
                                   block);
   if (NS_FAILED(rv)) return rv;
   // see if user canceled
   PRInt32 status;
@@ -614,17 +624,18 @@ NS_IMETHODIMP
 nsNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, 
                                     nsAString &_password,
                                     PRBool *_retval)
 {
   nsresult rv;
   *_retval = PR_TRUE;
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(ctx);
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
   // open up the window
   rv = nsNSSDialogHelper::openDialog(parent,
                                   "chrome://pippki/content/getp12password.xul",
                                   block);
   if (NS_FAILED(rv)) return rv;
   // see if user canceled
   PRInt32 status;
@@ -645,17 +656,18 @@ nsNSSDialogs::GetPKCS12FilePassword(nsII
 
 /* void viewCert (in nsIX509Cert cert); */
 NS_IMETHODIMP 
 nsNSSDialogs::ViewCert(nsIInterfaceRequestor *ctx, 
                        nsIX509Cert *cert)
 {
   nsresult rv;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
   if (!block)
     return NS_ERROR_FAILURE;
 
   rv = block->SetISupportAtIndex(1, cert);
   if (NS_FAILED(rv))
     return rv;
 
   // Get the parent window for the dialog
@@ -686,17 +698,18 @@ nsNSSDialogs::ChooseToken(nsIInterfaceRe
   nsresult rv;
   PRUint32 i;
 
   *aCanceled = PR_FALSE;
 
   // Get the parent window for the dialog
   nsCOMPtr<nsIDOMWindowInternal> parent = do_GetInterface(aCtx);
 
-  nsCOMPtr<nsIDialogParamBlock> block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
+  nsCOMPtr<nsIDialogParamBlock> block =
+           do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   block->SetNumberStrings(aCount);
 
   for (i = 0; i < aCount; i++) {
     rv = block->SetString(i, aTokenList[i]);
     if (NS_FAILED(rv)) return rv;
   }
@@ -726,17 +739,18 @@ nsNSSDialogs::ChooseToken(nsIInterfaceRe
 NS_IMETHODIMP 
 nsNSSDialogs::ConfirmKeyEscrow(nsIX509Cert *escrowAuthority, PRBool *_retval)
                                      
 {
   *_retval = PR_FALSE;
 
   nsresult rv;
 
-  nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
+  nsCOMPtr<nsIPKIParamBlock> block =
+           do_CreateInstance(NS_PKIPARAMBLOCK_CONTRACTID);
   if (!block)
     return NS_ERROR_FAILURE;
 
   rv = block->SetISupportAtIndex(1, escrowAuthority);
   if (NS_FAILED(rv))
     return rv;
 
   rv = nsNSSDialogHelper::openDialog(nsnull,
--- a/security/manager/ssl/src/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
@@ -685,19 +685,18 @@ nsHandleSSLError(nsNSSSocketInfo *socket
   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));
   if (NS_FAILED(rv))
     return rv;
 
   nsXPIDLCString hostName;
   socketInfo->GetHostName(getter_Copies(hostName));
   NS_ConvertASCIItoUTF16 hostNameU(hostName);
 
-  NS_DEFINE_CID(StringBundleServiceCID,  NS_STRINGBUNDLESERVICE_CID);
   nsCOMPtr<nsIStringBundleService> service = 
-                              do_GetService(StringBundleServiceCID, &rv);
+           do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
 
   nsString formattedString;
   rv = getErrorMessage(err, hostNameU, nssComponent, formattedString);
 
   PRBool external = PR_FALSE;
   socketInfo->GetExternalErrorReporting(&external);
   
   if (external)
--- a/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
+++ b/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
@@ -158,17 +158,17 @@ nsresult nsMIMEInfoOS2::LoadUriInternal(
 //  LOG(("-- nsOSHelperAppService::LoadUriInternal\n"));
   nsCOMPtr<nsIPref> thePrefsService(do_GetService(NS_PREF_CONTRACTID));
   if (!thePrefsService) {
     return NS_ERROR_FAILURE;
   }
 
   /* Convert SimpleURI to StandardURL */
   nsresult rv;
-  nsCOMPtr<nsIURI> uri = do_CreateInstance(kStandardURLCID, &rv);
+  nsCOMPtr<nsIURI> uri = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
   if (NS_FAILED(rv)) {
     return NS_ERROR_FAILURE;
   }
   nsCAutoString urlSpec;
   aURL->GetSpec(urlSpec);
   uri->SetSpec(urlSpec);
 
   /* Get the protocol so we can look up the preferences */
--- a/uriloader/exthandler/os2/nsMIMEInfoOS2.h
+++ b/uriloader/exthandler/os2/nsMIMEInfoOS2.h
@@ -37,17 +37,16 @@
 #ifndef nsMIMEInfoOS2_h_
 #define nsMIMEInfoOS2_h_
 
 #include "nsMIMEInfoImpl.h"
 
 #include "nsIPref.h" // XX Need to convert Handler code to new pref stuff
 #include "nsNetCID.h"
 #include "nsEscape.h"
-static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID); // XXX need to convert to contract id
 
 #define INCL_DOS
 #define INCL_DOSMISC
 #define INCL_DOSERRORS
 #define INCL_WINSHELLDATA
 #include <os2.h>
 
 #define MAXINIPARAMLENGTH 1024 // max length of OS/2 INI key for application parameters
--- a/widget/src/xpwidgets/nsPrintOptionsImpl.cpp
+++ b/widget/src/xpwidgets/nsPrintOptionsImpl.cpp
@@ -56,22 +56,19 @@
 
 // For Prefs
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 
 #include "nsIStringEnumerator.h"
 #include "nsISupportsPrimitives.h"
-#include "nsWidgetsCID.h"
 #include "stdlib.h"
 #include "nsAutoPtr.h"
 
-static NS_DEFINE_IID(kCPrinterEnumerator, NS_PRINTER_ENUMERATOR_CID);
-
 NS_IMPL_ISUPPORTS2(nsPrintOptions, nsIPrintOptions, nsIPrintSettingsService)
 
 // Pref Constants
     static const char kMarginTop[]       = "print_margin_top";
 static const char kMarginLeft[]      = "print_margin_left";
 static const char kMarginBottom[]    = "print_margin_bottom";
 static const char kMarginRight[]     = "print_margin_right";
 
@@ -108,18 +105,17 @@ static const char kPrintBGColors[]      
 static const char kPrintBGImages[]      = "print_bgimages";
 static const char kPrintShrinkToFit[]   = "print_shrink_to_fit";
 static const char kPrintScaling[]       = "print_scaling";
 
 static const char kJustLeft[]   = "left";
 static const char kJustCenter[] = "center";
 static const char kJustRight[]  = "right";
 
-static NS_DEFINE_IID(kPrinterEnumeratorCID, NS_PRINTER_ENUMERATOR_CID);
-
+#define NS_PRINTER_ENUMERATOR_CONTRACTID "@mozilla.org/gfx/printerenumerator;1"
 
 nsPrintOptions::nsPrintOptions()
 {
 }
 
 nsPrintOptions::~nsPrintOptions()
 {
 }
@@ -766,17 +762,17 @@ nsPrintOptions::DisplayJobProperties(con
                                      nsIPrintSettings* aPrintSettings,
                                      PRBool *aDisplayed)
 {
   NS_ENSURE_ARG_POINTER(aPrinter);
   *aDisplayed = PR_FALSE;
 
   nsresult rv;
   nsCOMPtr<nsIPrinterEnumerator> propDlg =
-    do_CreateInstance(kCPrinterEnumerator, &rv);
+           do_CreateInstance(NS_PRINTER_ENUMERATOR_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ENSURE_ARG_POINTER(aPrintSettings);
   rv = propDlg->DisplayPropertiesDlg(aPrinter, aPrintSettings);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aDisplayed = PR_TRUE;
 
@@ -830,18 +826,18 @@ nsPrintOptions::GetNewPrintSettings(nsIP
 {
   return CreatePrintSettings(aNewPrintSettings);
 }
 
 NS_IMETHODIMP
 nsPrintOptions::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName)
 {
   nsresult rv;
-  nsCOMPtr<nsIPrinterEnumerator> prtEnum = do_GetService(kPrinterEnumeratorCID,
-                                                         &rv);
+  nsCOMPtr<nsIPrinterEnumerator> prtEnum =
+           do_GetService(NS_PRINTER_ENUMERATOR_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Look up the printer from the last print job
   nsAutoString lastPrinterName;
   ReadPrefString(kPrinterName, lastPrinterName);
   if (!lastPrinterName.IsEmpty()) {
     // Verify it's still a valid printer
     nsCOMPtr<nsIStringEnumerator> printers;
@@ -884,18 +880,18 @@ nsPrintOptions::InitPrintSettingsFromPri
 #endif
 
   PRBool isInitialized;
   aPrintSettings->GetIsInitializedFromPrinter(&isInitialized);
   if (isInitialized)
     return NS_OK;
 
   nsresult rv;
-  nsCOMPtr<nsIPrinterEnumerator> prtEnum = do_GetService(kPrinterEnumeratorCID,
-                                                         &rv);
+  nsCOMPtr<nsIPrinterEnumerator> prtEnum =
+           do_GetService(NS_PRINTER_ENUMERATOR_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = prtEnum->InitPrintSettingsFromPrinter(aPrinterName, aPrintSettings);
   NS_ENSURE_SUCCESS(rv, rv);
 
   aPrintSettings->SetIsInitializedFromPrinter(PR_TRUE);
   return rv;
 }
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -67,17 +67,16 @@
 #include "nsIDOMXULElement.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMScreen.h"
 #include "nsIEmbeddingSiteWindow.h"
 #include "nsIEmbeddingSiteWindow2.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIIOService.h"
-#include "nsNetCID.h"
 #include "nsIJSContextStack.h"
 #include "nsIMarkupDocumentViewer.h"
 #include "nsIObserverService.h"
 #include "nsIWindowMediator.h"
 #include "nsIScreenManager.h"
 #include "nsIScreen.h"
 #include "nsIScrollable.h"
 #include "nsIPrefService.h"
@@ -103,19 +102,16 @@
 
 #define PERSIST_ATTRIBUTE  NS_LITERAL_STRING("persist")
 #define SCREENX_ATTRIBUTE  NS_LITERAL_STRING("screenX")
 #define SCREENY_ATTRIBUTE  NS_LITERAL_STRING("screenY")
 #define WIDTH_ATTRIBUTE    NS_LITERAL_STRING("width")
 #define HEIGHT_ATTRIBUTE   NS_LITERAL_STRING("height")
 #define MODE_ATTRIBUTE     NS_LITERAL_STRING("sizemode")
 #define ZLEVEL_ATTRIBUTE   NS_LITERAL_STRING("zlevel")
-// CIDs
-static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
-static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
 
 //*****************************************************************************
 //***    nsXULWindow: Object Management
 //*****************************************************************************
 
 nsXULWindow::nsXULWindow()
   : mChromeTreeOwner(nsnull), 
     mContentTreeOwner(nsnull),
@@ -207,27 +203,27 @@ NS_IMETHODIMP nsXULWindow::GetDocShell(n
 
   *aDocShell = mDocShell;
   NS_IF_ADDREF(*aDocShell);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::GetZLevel(PRUint32 *outLevel)
 {
-  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
+  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (mediator)
     mediator->GetZLevel(this, outLevel);
   else
     *outLevel = normalZ;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::SetZLevel(PRUint32 aLevel)
 {
-  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
+  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!mediator)
     return NS_ERROR_FAILURE;
 
   PRUint32 zLevel;
   mediator->GetZLevel(this, &zLevel);
   if (zLevel == aLevel)
     return NS_OK;
 
@@ -760,17 +756,17 @@ NS_IMETHODIMP nsXULWindow::SetVisibility
   mDebuting = PR_TRUE;  // (Show / Focus is recursive)
 
   //XXXTAB Do we really need to show docshell and the window?  Isn't 
   // the window good enough?
   nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(mDocShell));
   shellAsWin->SetVisibility(aVisibility);
   mWindow->Show(aVisibility);
 
-  nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID));
+  nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (windowMediator)
      windowMediator->UpdateWindowTimeStamp(static_cast<nsIXULWindow*>(this));
 
   // notify observers so that we can hide the splash screen if possible
   nsCOMPtr<nsIObserverService> obssvc
     (do_GetService("@mozilla.org/observer-service;1"));
   NS_ASSERTION(obssvc, "Couldn't get observer service.");
   if (obssvc) {
@@ -854,17 +850,17 @@ NS_IMETHODIMP nsXULWindow::GetTitle(PRUn
 NS_IMETHODIMP nsXULWindow::SetTitle(const PRUnichar* aTitle)
 {
   NS_ENSURE_STATE(mWindow);
   mTitle.Assign(aTitle);
   mTitle.StripChars("\n\r");
   NS_ENSURE_SUCCESS(mWindow->SetTitle(mTitle), NS_ERROR_FAILURE);
 
   // Tell the window mediator that a title has changed
-  nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID));
+  nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if(!windowMediator)
     return NS_OK;
 
   windowMediator->UpdateWindowTitle(static_cast<nsIXULWindow*>(this), aTitle);
 
   return NS_OK;
 }
 
@@ -1498,17 +1494,17 @@ NS_IMETHODIMP nsXULWindow::SavePersisten
       else
         sizeString.Assign(SIZEMODE_NORMAL);
       docShellElement->SetAttribute(MODE_ATTRIBUTE, sizeString);
       if (ownerXULDoc)
         ownerXULDoc->Persist(windowElementId, MODE_ATTRIBUTE);
     }
     if (persistString.Find("zlevel") >= 0) {
       PRUint32 zLevel;
-      nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
+      nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
       if (mediator) {
         mediator->GetZLevel(this, &zLevel);
         PR_snprintf(sizeBuf, sizeof(sizeBuf), "%lu", (unsigned long)zLevel);
         sizeString.AssignWithConversion(sizeBuf);
         docShellElement->SetAttribute(ZLEVEL_ATTRIBUTE, sizeString);
         ownerXULDoc->Persist(windowElementId, ZLEVEL_ATTRIBUTE);
       }
     }
@@ -1844,17 +1840,17 @@ PRBool nsXULWindow::ConstrainToZLevel(
      since we're a dependent window. Our window list isn't hierarchical,
      so we can't properly calculate placement for such a window.
      Should we just abort? */
   nsCOMPtr<nsIBaseWindow> parentWindow = do_QueryReferent(mParentWindow);
   if (parentWindow)
     return PR_FALSE;
 #endif
 
-  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
+  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if(!mediator)
     return PR_FALSE;
 
   PRBool         altered;
   PRUint32       position,
                  newPosition,
                  zLevel;
   nsIXULWindow  *us = this;
@@ -1934,17 +1930,17 @@ PRBool nsXULWindow::ConstrainToZLevel(
    external applications.
 */
 void nsXULWindow::PlaceWindowLayersBehind(PRUint32 aLowLevel,
                                           PRUint32 aHighLevel,
                                           nsIXULWindow *aBehind) {
 
   // step through windows in z-order from top to bottommost window
 
-  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
+  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if(!mediator)
     return;
 
   nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
   mediator->GetZOrderXULWindowEnumerator(0, PR_TRUE,
               getter_AddRefs(windowEnumerator));
   if (!windowEnumerator)
     return;
--- a/xpinstall/src/nsXPInstallManager.cpp
+++ b/xpinstall/src/nsXPInstallManager.cpp
@@ -87,18 +87,16 @@
 
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #include "CertReader.h"
 
 #include "nsEmbedCID.h"
 
-static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
-
 #define PREF_XPINSTALL_ENABLED                "xpinstall.enabled"
 #define PREF_XPINSTALL_CONFIRM_DLG            "xpinstall.dialog.confirm"
 #define PREF_XPINSTALL_STATUS_DLG_SKIN        "xpinstall.dialog.progress.skin"
 #define PREF_XPINSTALL_STATUS_DLG_CHROME      "xpinstall.dialog.progress.chrome"
 #define PREF_XPINSTALL_STATUS_DLG_TYPE_SKIN   "xpinstall.dialog.progress.type.skin"
 #define PREF_XPINSTALL_STATUS_DLG_TYPE_CHROME "xpinstall.dialog.progress.type.chrome"
 
 #define UPDATE_DLG(x)  (((x) - mLastUpdate) > 250000)
@@ -432,17 +430,17 @@ nsXPInstallManager::ConfirmInstall(nsIDO
 
 #ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
 PRBool nsXPInstallManager::ConfirmChromeInstall(nsIDOMWindowInternal* aParentWindow, const PRUnichar **aPackage)
 {
     // get the dialog strings
     nsXPIDLString applyNowText;
     nsXPIDLString confirmText;
     nsCOMPtr<nsIStringBundleService> bundleSvc =
-             do_GetService( kStringBundleServiceCID );
+             do_GetService(NS_STRINGBUNDLE_CONTRACTID);
     if (!bundleSvc)
         return PR_FALSE;
 
     nsCOMPtr<nsIStringBundle> xpiBundle;
     bundleSvc->CreateBundle( XPINSTALL_BUNDLE_URL,
                              getter_AddRefs(xpiBundle) );
     if (!xpiBundle)
         return PR_FALSE;