diff --git a/browser/components/bookmarks/src/nsBookmarksService.cpp b/browser/components/bookmarks/src/nsBookmarksService.cpp index 77044e776cf..725b297becd 100644 --- a/browser/components/bookmarks/src/nsBookmarksService.cpp +++ b/browser/components/bookmarks/src/nsBookmarksService.cpp @@ -1960,9 +1960,9 @@ nsBookmarksService::GetBookmarkToPing(nsIRDFResource **theBookmark) if (NS_FAILED(rv = GetSources(kWEB_ScheduleActive, kTrueLiteral, PR_TRUE, getter_AddRefs(srcList)))) return rv; - nsCOMPtr bookmarkList; - if (NS_FAILED(rv = NS_NewISupportsArray(getter_AddRefs(bookmarkList)))) - return rv; + nsCOMPtr bookmarkList = + do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); // build up a list of potential bookmarks to check PRBool hasMoreSrcs = PR_TRUE; @@ -2447,8 +2447,8 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt, if (wwatch) { nsCOMPtr newWindow; - nsCOMPtr suppArray; - rv = NS_NewISupportsArray(getter_AddRefs(suppArray)); + nsCOMPtr suppArray = + do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr suppString(do_CreateInstance("@mozilla.org/supports-string;1", &rv)); if (!suppString) return rv; @@ -4101,10 +4101,7 @@ NS_IMETHODIMP nsBookmarksService::GetAllCmds(nsIRDFResource* source, nsISimpleEnumerator/**/** commands) { - nsCOMPtr cmdArray; - nsresult rv; - rv = NS_NewISupportsArray(getter_AddRefs(cmdArray)); - if (NS_FAILED(rv)) return rv; + nsCOMArray cmdArray; // determine type nsCOMPtr nodeType; @@ -4118,38 +4115,38 @@ nsBookmarksService::GetAllCmds(nsIRDFResource* source, if (isBookmark || isBookmarkFolder || isBookmarkSeparator || isLivemark) { - cmdArray->AppendElement(kNC_BookmarkCommand_NewBookmark); - cmdArray->AppendElement(kNC_BookmarkCommand_NewFolder); - cmdArray->AppendElement(kNC_BookmarkCommand_NewSeparator); - cmdArray->AppendElement(kNC_BookmarkSeparator); + cmdArray.AppendObject(kNC_BookmarkCommand_NewBookmark); + cmdArray.AppendObject(kNC_BookmarkCommand_NewFolder); + cmdArray.AppendObject(kNC_BookmarkCommand_NewSeparator); + cmdArray.AppendObject(kNC_BookmarkSeparator); } if (isBookmark || isLivemark) { - cmdArray->AppendElement(kNC_BookmarkCommand_DeleteBookmark); + cmdArray.AppendObject(kNC_BookmarkCommand_DeleteBookmark); } if (isLivemark) { - cmdArray->AppendElement(kNC_BookmarkCommand_RefreshLivemark); + cmdArray.AppendObject(kNC_BookmarkCommand_RefreshLivemark); } if (isBookmarkFolder && (source != kNC_BookmarksRoot) && (source != kNC_IEFavoritesRoot)) { - cmdArray->AppendElement(kNC_BookmarkCommand_DeleteBookmarkFolder); + cmdArray.AppendObject(kNC_BookmarkCommand_DeleteBookmarkFolder); } if (isBookmarkSeparator) { - cmdArray->AppendElement(kNC_BookmarkCommand_DeleteBookmarkSeparator); + cmdArray.AppendObject(kNC_BookmarkCommand_DeleteBookmarkSeparator); } if (isBookmarkFolder) { nsCOMPtr personalToolbarFolder; GetBookmarksToolbarFolder(getter_AddRefs(personalToolbarFolder)); - cmdArray->AppendElement(kNC_BookmarkSeparator); - if (source != personalToolbarFolder.get()) cmdArray->AppendElement(kNC_BookmarkCommand_SetPersonalToolbarFolder); + cmdArray.AppendObject(kNC_BookmarkSeparator); + if (source != personalToolbarFolder.get()) cmdArray.AppendObject(kNC_BookmarkCommand_SetPersonalToolbarFolder); } // always append a separator last (due to aggregation of commands from multiple datasources) - cmdArray->AppendElement(kNC_BookmarkSeparator); + cmdArray.AppendObject(kNC_BookmarkSeparator); return NS_NewArrayEnumerator(commands, cmdArray); } @@ -4178,8 +4175,10 @@ nsBookmarksService::getArgumentN(nsISupportsArray *arguments, nsIRDFResource *re // multiple arguments can be the same, by the way, thus the "offset" for (loop = 0; loop < numArguments; loop += 2) { - nsCOMPtr src = do_QueryElementAt(arguments, loop, &rv); - if (!src) return rv; + nsCOMPtr src; + rv = arguments->QueryElementAt(loop, NS_GET_IID(nsIRDFResource), + getter_AddRefs(src)); + if (NS_FAILED(rv)) return rv; if (src == res) { @@ -4189,9 +4188,10 @@ nsBookmarksService::getArgumentN(nsISupportsArray *arguments, nsIRDFResource *re continue; } - nsCOMPtr val = do_QueryElementAt(arguments, loop + 1, - &rv); - if (!val) return rv; + nsCOMPtr val; + rv = arguments->QueryElementAt(loop + 1, NS_GET_IID(nsIRDFNode), + getter_AddRefs(val)); + if (NS_FAILED(rv)) return rv; *argValue = val; NS_ADDREF(*argValue); @@ -4303,8 +4303,10 @@ nsBookmarksService::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aComma for (loop=((PRInt32)numSources)-1; loop>=0; loop--) { - nsCOMPtr src = do_QueryElementAt(aSources, loop, &rv); - if (!src) return rv; + nsCOMPtr src; + rv = aSources->QueryElementAt(loop, NS_GET_IID(nsIRDFResource), + getter_AddRefs(src)); + if (NS_FAILED(rv)) return rv; if (aCommand == kNC_BookmarkCommand_NewBookmark) { diff --git a/browser/components/bookmarks/src/nsForwardProxyDataSource.cpp b/browser/components/bookmarks/src/nsForwardProxyDataSource.cpp index d0d15a708ea..4065139e2b8 100644 --- a/browser/components/bookmarks/src/nsForwardProxyDataSource.cpp +++ b/browser/components/bookmarks/src/nsForwardProxyDataSource.cpp @@ -488,7 +488,8 @@ nsForwardProxyDataSource::GetProxyResourcesArray (nsISupportsArray* aSources, // have aggregate resources -- if they're found, append them // to a new array for (PRUint32 i = 0; i < sourcesCount; i++) { - source = do_QueryElementAt(aSources, i, &rv); + rv = aSources->QueryElementAt(i, NS_GET_IID(nsIRDFResource), + getter_AddRefs(source)); if (NS_FAILED(rv)) return rv; if (GetProxyResource(source, getter_AddRefs(proxyResource)) == NS_OK) { diff --git a/browser/components/migration/src/nsBrowserProfileMigratorUtils.cpp b/browser/components/migration/src/nsBrowserProfileMigratorUtils.cpp index afbcfea2545..a945c028791 100644 --- a/browser/components/migration/src/nsBrowserProfileMigratorUtils.cpp +++ b/browser/components/migration/src/nsBrowserProfileMigratorUtils.cpp @@ -229,8 +229,8 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile, do_GetService("@mozilla.org/browser/bookmarks-service;1", &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr params; - rv = NS_NewISupportsArray(getter_AddRefs(params)); + nsCOMPtr params = + do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr rdfs = @@ -312,8 +312,8 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile, params->AppendElement(folderProp); params->AppendElement(folder); - nsCOMPtr sources; - rv = NS_NewISupportsArray(getter_AddRefs(sources)); + nsCOMPtr sources = + do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); sources->AppendElement(folder);