Followup patch to bug 397277 Make /suite build with --enable-libxul r=Standard8
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sat, 30 Aug 2008 21:45:35 +0100
changeset 233 325c0ff70623fe3ef9d656719941da668cf077a1
parent 232 3013cce23498a26426ae00831922c67baa3c8fba
child 234 00d766fa45630987eea96c9e8c48a4f81b47c8b0
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs397277
Followup patch to bug 397277 Make /suite build with --enable-libxul r=Standard8
suite/browser/src/nsBookmarksService.cpp
suite/browser/src/nsInternetSearchService.cpp
suite/build/Makefile.in
suite/profile/migration/src/nsProfileMigrator.cpp
suite/profile/migration/src/nsSuiteProfileMigratorUtils.cpp
--- a/suite/browser/src/nsBookmarksService.cpp
+++ b/suite/browser/src/nsBookmarksService.cpp
@@ -1980,18 +1980,18 @@ nsBookmarksService::GetBookmarkToPing(ns
     nsresult    rv = NS_OK;
 
     *theBookmark = nsnull;
 
     nsCOMPtr<nsISimpleEnumerator>   srcList;
     if (NS_FAILED(rv = GetSources(kWEB_ScheduleActive, kTrueLiteral, PR_TRUE, getter_AddRefs(srcList))))
         return rv;
 
-    nsCOMPtr<nsISupportsArray>  bookmarkList;
-    if (NS_FAILED(rv = NS_NewISupportsArray(getter_AddRefs(bookmarkList))))
+    nsCOMPtr<nsISupportsArray> bookmarkList(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
+    if (NS_FAILED(rv))
         return rv;
 
     // build up a list of potential bookmarks to check
     PRBool  hasMoreSrcs = PR_TRUE;
     while(NS_SUCCEEDED(rv = srcList->HasMoreElements(&hasMoreSrcs))
         && (hasMoreSrcs == PR_TRUE))
     {
         nsCOMPtr<nsISupports>   aSrc;
@@ -2438,18 +2438,17 @@ nsBookmarksService::OnStopRequest(nsIReq
                 schedule.Find(NS_LITERAL_STRING("open"), PR_TRUE) != -1)
             {
                 if (NS_SUCCEEDED(rv))
                 {
                     nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
                     if (wwatch)
                     {
                         nsCOMPtr<nsIDOMWindow> newWindow;
-                        nsCOMPtr<nsISupportsArray> suppArray;
-                        rv = NS_NewISupportsArray(getter_AddRefs(suppArray));
+                        nsCOMPtr<nsISupportsArray> suppArray(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
                         if (NS_FAILED(rv)) return rv;
 
                         nsCOMPtr<nsISupportsString> suppString(do_CreateInstance("@mozilla.org/supports-string;1", &rv));
                         if (!suppString) return rv;
 
                         rv = suppString->SetData(url);
                         if (NS_FAILED(rv)) return rv;
 
@@ -4393,19 +4392,18 @@ nsBookmarksService::GetAllResources(nsIS
   
     return mInner->GetAllResources(aResult);
 }
 
 NS_IMETHODIMP
 nsBookmarksService::GetAllCmds(nsIRDFResource* source,
                    nsISimpleEnumerator/*<nsIRDFResource>*/** commands)
 {
-    nsCOMPtr<nsISupportsArray>  cmdArray;
     nsresult            rv;
-    rv = NS_NewISupportsArray(getter_AddRefs(cmdArray));
+    nsCOMPtr<nsISupportsArray> cmdArray(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
     if (NS_FAILED(rv))  return rv;
 
     // determine type
     nsCOMPtr<nsIRDFNode> nodeType;
     GetSynthesizedType(source, getter_AddRefs(nodeType));
 
     PRBool  isBookmark, isBookmarkFolder, isBookmarkSeparator;
     isBookmark = (nodeType == kNC_Bookmark) ? PR_TRUE : PR_FALSE;
--- a/suite/browser/src/nsInternetSearchService.cpp
+++ b/suite/browser/src/nsInternetSearchService.cpp
@@ -774,17 +774,17 @@ InternetSearchDataSource::Init()
   mInner = do_CreateInstance(NS_RDF_DATASOURCE_CONTRACTID_PREFIX "in-memory-datasource");
   NS_ENSURE_TRUE(mRDFService && mInner, NS_ERROR_FAILURE);
 
   // get localstore, as we'll be using it
   rv = mRDFService->GetDataSource("rdf:local-store",
                                   getter_AddRefs(mLocalstore));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = NS_NewISupportsArray(getter_AddRefs(mUpdateArray));
+  mUpdateArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // register this as a named data source with the service manager
   rv = mRDFService->RegisterDataSource(this, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = NS_NewLoadGroup(getter_AddRefs(mLoadGroup), nsnull);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1439,18 +1439,17 @@ InternetSearchDataSource::ArcLabelsOut(n
   NS_PRECONDITION(labels != nsnull, "null ptr");
   if (! labels)
     return NS_ERROR_NULL_POINTER;
 
   nsresult rv;
 
   if ((source == mNC_SearchEngineRoot) || (source == mNC_LastSearchRoot) || isSearchURI(source))
   {
-            nsCOMPtr<nsISupportsArray> array;
-            rv = NS_NewISupportsArray(getter_AddRefs(array));
+            nsCOMPtr<nsISupportsArray> array(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
             if (NS_FAILED(rv)) return rv;
 
             array->AppendElement(mNC_Child);
 
             return NS_NewArrayEnumerator(labels, array);
   }
 
   if ((isSearchCategoryURI(source)) && (categoryDataSource))
@@ -1537,19 +1536,18 @@ InternetSearchDataSource::RemoveObserver
 }
 
 
 
 NS_IMETHODIMP
 InternetSearchDataSource::GetAllCmds(nsIRDFResource* source,
                                      nsISimpleEnumerator/*<nsIRDFResource>*/** commands)
 {
-  nsCOMPtr<nsISupportsArray>  cmdArray;
   nsresult      rv;
-  rv = NS_NewISupportsArray(getter_AddRefs(cmdArray));
+  nsCOMPtr<nsISupportsArray> cmdArray(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
   if (NS_FAILED(rv))  return(rv);
 
   // check if we have any filters, enable command to clear them
   PRBool        haveFilters = PR_FALSE;
 
   if (mLocalstore)
   {
     nsCOMPtr<nsISimpleEnumerator> cursor;
@@ -1904,22 +1902,21 @@ InternetSearchDataSource::filterSite(nsI
   nsCOMPtr<nsIRDFRemoteDataSource> remoteLocalStore (do_QueryInterface(mLocalstore));
   if (remoteLocalStore)
   {
     remoteLocalStore->Flush();
   }
 
   // remove all anonymous resources which have this as a site
 
-  nsCOMPtr<nsISupportsArray>  array;
   nsCOMPtr<nsIRDFResource>  aRes;
   nsCOMPtr<nsISimpleEnumerator> cursor;
   PRBool        hasMore;
 
-  rv = NS_NewISupportsArray(getter_AddRefs(array));
+  nsCOMPtr<nsISupportsArray> array(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
   if (NS_FAILED(rv)) return rv;
 
   if (NS_FAILED(rv = GetAllResources(getter_AddRefs(cursor))))  return(rv);
   if (!cursor)  return(NS_ERROR_UNEXPECTED);
 
   hasMore = PR_TRUE;
   while (hasMore)
   {
--- a/suite/build/Makefile.in
+++ b/suite/build/Makefile.in
@@ -62,16 +62,22 @@ REQUIRES	= \
 		xpcom \
 		xulapp \
 		$(NULL)
 
 CPPSRCS 	= \
 		nsSuiteModule.cpp \
 		$(NULL)
 
+ifdef MOZ_ENABLE_LIBXUL
+CPPSRCS		+= \
+		nsSupportsArray.cpp \
+		$(NULL)
+endif
+
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,ole32 shell32)
 endif
 
 LOCAL_INCLUDES += \
 		-I$(topsrcdir)/suite/profile \
 		-I$(topsrcdir)/suite/profile/migration/src \
 		-I$(topsrcdir)/suite/browser/src \
@@ -83,28 +89,23 @@ SHARED_LIBRARY_LIBS = \
 	../profile/migration/src/$(LIB_PREFIX)suitemigration_s.$(LIB_SUFFIX) \
 	../browser/src/$(LIB_PREFIX)suitebrowser_s.$(LIB_SUFFIX) \
 	$(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 SHARED_LIBRARY_LIBS += ../shell/src/$(LIB_PREFIX)shellservice_s.$(LIB_SUFFIX)
 endif
 
-# Link to gkgfx for GNOME shell service
-ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
-EXTRA_DSO_LIBS += gkgfx
-endif
-
 EXTRA_DSO_LDOPTS += \
 	$(LIBS_DIR) \
 	$(EXTRA_DSO_LIBS) \
 	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
 	$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
 	$(MOZ_JS_LIBS) \
-	$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
+	$(XPCOM_GLUE_LDOPTS) \
 	$(MOZ_COMPONENT_LIBS) \
 	$(NULL)
 
 # Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code)
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += \
 	$(TK_LIBS) \
 	$(NULL)
--- a/suite/profile/migration/src/nsProfileMigrator.cpp
+++ b/suite/profile/migration/src/nsProfileMigrator.cpp
@@ -91,18 +91,17 @@ nsProfileMigrator::Migrate(nsIProfileSta
     (do_CreateInstance("@mozilla.org/supports-cstring;1"));
   if (!cstr)
     return NS_ERROR_OUT_OF_MEMORY;
   cstr->SetData(key);
 
   // By opening the Migration FE with a supplied spm, it will automatically
   // migrate from it.
   nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-  nsCOMPtr<nsISupportsArray> params;
-  NS_NewISupportsArray(getter_AddRefs(params));
+  nsCOMPtr<nsISupportsArray> params(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
   if (!ww || !params)
     return NS_ERROR_FAILURE;
 
   params->AppendElement(cstr);
   params->AppendElement(spm);
   params->AppendElement(aStartup);
 
   nsCOMPtr<nsIDOMWindow> migrateWizard;
--- a/suite/profile/migration/src/nsSuiteProfileMigratorUtils.cpp
+++ b/suite/profile/migration/src/nsSuiteProfileMigratorUtils.cpp
@@ -218,18 +218,17 @@ ImportBookmarksHTML(nsIFile* aBookmarksF
                     const PRUnichar* aImportSourceNameKey)
 {
   nsresult rv;
 
   nsCOMPtr<nsIBookmarksService> bms =
     do_GetService("@mozilla.org/browser/bookmarks-service;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<nsISupportsArray> params;
-  rv = NS_NewISupportsArray(getter_AddRefs(params));
+  nsCOMPtr<nsISupportsArray> params(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIRDFService> rdfs =
     do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIRDFResource> prop;
   rv = rdfs->GetResource(NC_URI(URL), getter_AddRefs(prop));
@@ -277,18 +276,17 @@ ImportBookmarksHTML(nsIFile* aBookmarksF
 
   nsCOMPtr<nsIRDFResource> folderProp;
   rv = rdfs->GetResource(NC_URI(Folder), getter_AddRefs(folderProp));
   NS_ENSURE_SUCCESS(rv, rv);
 
   params->AppendElement(folderProp);
   params->AppendElement(folder);
 
-  nsCOMPtr<nsISupportsArray> sources;
-  rv = NS_NewISupportsArray(getter_AddRefs(sources));
+  nsCOMPtr<nsISupportsArray> sources(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
   sources->AppendElement(folder);
 
   nsCOMPtr<nsIRDFDataSource> ds = do_QueryInterface(bms, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return ds->DoCommand(sources, importCmd, params);
 }