From d986dfc66d456e54f6d2e446dc95c9f2d1243c22 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 4 Nov 2016 11:03:26 -0700 Subject: [PATCH] Bug 1309409 - Part 1: Remove nsISupportsArray usage from nsIRDFDataSource. r=Pike This converts the usage of nsISupportsArray in nsIRDFDataSource to just nsISupports. Internally none of the params are used, all external usages in the addons repo appear to just be passthroughs. Regardless, any external implementors wanting to pass in an nsISupportsArray can still do so as it is derived from nsISupports. Additionally the |IsCommandEnabled| and |DoCommand| stubs are updated to just return NS_ERROR_NOT_IMPLEMENTED as this functionallity is currently not supported. MozReview-Commit-ID: JJSHAQKiLSZ --- rdf/base/nsCompositeDataSource.cpp | 8 +++---- rdf/base/nsIRDFDataSource.idl | 9 ++++---- rdf/base/nsInMemoryDataSource.cpp | 17 +++++++------- rdf/base/nsRDFXMLDataSource.cpp | 14 +++++------- rdf/datasource/nsFileSystemDataSource.cpp | 9 ++++---- rdf/datasource/nsLocalStore.cpp | 22 +++++++++---------- .../directory/nsDirectoryViewer.cpp | 22 +++++-------------- .../windowds/nsWindowDataSource.cpp | 12 ++++------ 8 files changed, 46 insertions(+), 67 deletions(-) diff --git a/rdf/base/nsCompositeDataSource.cpp b/rdf/base/nsCompositeDataSource.cpp index bafff413798b..37167d356678 100644 --- a/rdf/base/nsCompositeDataSource.cpp +++ b/rdf/base/nsCompositeDataSource.cpp @@ -1099,9 +1099,9 @@ CompositeDataSourceImpl::GetAllCmds(nsIRDFResource* source, } NS_IMETHODIMP -CompositeDataSourceImpl::IsCommandEnabled(nsISupportsArray/**/* aSources, +CompositeDataSourceImpl::IsCommandEnabled(nsISupports/* nsIRDFResource container */* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, + nsISupports/* nsIRDFResource container */* aArguments, bool* aResult) { nsresult rv; @@ -1123,9 +1123,9 @@ CompositeDataSourceImpl::IsCommandEnabled(nsISupportsArray/**/* } NS_IMETHODIMP -CompositeDataSourceImpl::DoCommand(nsISupportsArray/**/* aSources, +CompositeDataSourceImpl::DoCommand(nsISupports/* nsIRDFResource container */* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) + nsISupports/* nsIRDFResource container */* aArguments) { for (int32_t i = mDataSources.Count() - 1; i >= 0; --i) { nsresult rv = mDataSources[i]->DoCommand(aSources, aCommand, aArguments); diff --git a/rdf/base/nsIRDFDataSource.idl b/rdf/base/nsIRDFDataSource.idl index df383330a994..2915425c8530 100644 --- a/rdf/base/nsIRDFDataSource.idl +++ b/rdf/base/nsIRDFDataSource.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsISupportsArray.idl" #include "nsIRDFResource.idl" #include "nsIRDFNode.idl" #include "nsISimpleEnumerator.idl" @@ -138,16 +137,16 @@ interface nsIRDFDataSource : nsISupports /** * Returns whether a given command is enabled for a set of sources. */ - boolean IsCommandEnabled(in nsISupportsArray aSources, + boolean IsCommandEnabled(in nsISupports aSources, in nsIRDFResource aCommand, - in nsISupportsArray aArguments); + in nsISupports aArguments); /** * Perform the specified command on set of sources. */ - void DoCommand(in nsISupportsArray aSources, + void DoCommand(in nsISupports aSources, in nsIRDFResource aCommand, - in nsISupportsArray aArguments); + in nsISupports aArguments); /** * Returns the set of all commands defined for a given source. diff --git a/rdf/base/nsInMemoryDataSource.cpp b/rdf/base/nsInMemoryDataSource.cpp index 87267702522b..a697aee5a346 100644 --- a/rdf/base/nsInMemoryDataSource.cpp +++ b/rdf/base/nsInMemoryDataSource.cpp @@ -1584,21 +1584,20 @@ InMemoryDataSource::GetAllCmds(nsIRDFResource* source, } NS_IMETHODIMP -InMemoryDataSource::IsCommandEnabled(nsISupportsArray/**/* aSources, +InMemoryDataSource::IsCommandEnabled(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, + nsISupports* aArguments, bool* aResult) { - *aResult = false; - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -InMemoryDataSource::DoCommand(nsISupportsArray/**/* aSources, +InMemoryDataSource::DoCommand(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) + nsISupports* aArguments) { - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP @@ -1883,7 +1882,7 @@ InMemoryDataSource::VisitAllSubjects(rdfITripleVisitor *aVisitor) // Lock datasource against writes ++mReadCount; - // Enumerate all of our entries into an nsISupportsArray. + // Enumerate all of our entries. nsresult rv = NS_OK; for (auto iter = mForwardArcs.Iter(); !iter.Done(); iter.Next()) { auto entry = static_cast(iter.Get()); @@ -1911,7 +1910,7 @@ InMemoryDataSource::VisitAllTriples(rdfITripleVisitor *aVisitor) // Lock datasource against writes ++mReadCount; - // Enumerate all of our entries into an nsISupportsArray. + // Enumerate all of our entries. nsresult rv = NS_OK; for (auto iter = mForwardArcs.Iter(); !iter.Done(); iter.Next()) { auto entry = static_cast(iter.Get()); diff --git a/rdf/base/nsRDFXMLDataSource.cpp b/rdf/base/nsRDFXMLDataSource.cpp index 62d6c93dd3e2..0e9127420eb7 100644 --- a/rdf/base/nsRDFXMLDataSource.cpp +++ b/rdf/base/nsRDFXMLDataSource.cpp @@ -249,19 +249,17 @@ public: return mInner->GetAllCmds(source, commands); } - NS_IMETHOD IsCommandEnabled(nsISupportsArray/**/* aSources, + NS_IMETHOD IsCommandEnabled(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, + nsISupports* aArguments, bool* aResult) override { - return mInner->IsCommandEnabled(aSources, aCommand, aArguments, aResult); + return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHOD DoCommand(nsISupportsArray/**/* aSources, + NS_IMETHOD DoCommand(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) override { - // XXX Uh oh, this could cause problems wrt. the "dirty" flag - // if it changes the in-memory store's internal state. - return mInner->DoCommand(aSources, aCommand, aArguments); + nsISupports* aArguments) override { + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHOD BeginUpdateBatch() override { diff --git a/rdf/datasource/nsFileSystemDataSource.cpp b/rdf/datasource/nsFileSystemDataSource.cpp index 11a56bc124b1..35632d1a3bb5 100644 --- a/rdf/datasource/nsFileSystemDataSource.cpp +++ b/rdf/datasource/nsFileSystemDataSource.cpp @@ -13,7 +13,6 @@ #include #include "nsArrayEnumerator.h" #include "nsCOMArray.h" -#include "nsISupportsArray.h" #include "nsIRDFDataSource.h" #include "nsIRDFObserver.h" #include "nsIServiceManager.h" @@ -801,9 +800,9 @@ FileSystemDataSource::GetAllCmds(nsIRDFResource* source, NS_IMETHODIMP -FileSystemDataSource::IsCommandEnabled(nsISupportsArray/**/* aSources, +FileSystemDataSource::IsCommandEnabled(nsISupports/**/* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, + nsISupports/**/* aArguments, bool* aResult) { return(NS_ERROR_NOT_IMPLEMENTED); @@ -812,9 +811,9 @@ FileSystemDataSource::IsCommandEnabled(nsISupportsArray/**/* aSo NS_IMETHODIMP -FileSystemDataSource::DoCommand(nsISupportsArray/**/* aSources, +FileSystemDataSource::DoCommand(nsISupports/**/* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) + nsISupports/**/* aArguments) { return(NS_ERROR_NOT_IMPLEMENTED); } diff --git a/rdf/datasource/nsLocalStore.cpp b/rdf/datasource/nsLocalStore.cpp index 01a79be205ae..b6218b425075 100644 --- a/rdf/datasource/nsLocalStore.cpp +++ b/rdf/datasource/nsLocalStore.cpp @@ -165,14 +165,14 @@ public: NS_IMETHOD GetAllCmds(nsIRDFResource* aSource, nsISimpleEnumerator/**/** aCommands) override; - NS_IMETHOD IsCommandEnabled(nsISupportsArray/**/* aSources, + NS_IMETHOD IsCommandEnabled(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, + nsISupports* aArguments, bool* aResult) override; - NS_IMETHOD DoCommand(nsISupportsArray/**/* aSources, + NS_IMETHOD DoCommand(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) override; + nsISupports* aArguments) override; NS_IMETHOD BeginUpdateBatch() override { return mInner->BeginUpdateBatch(); @@ -441,22 +441,20 @@ LocalStoreImpl::GetAllCmds(nsIRDFResource* aSource, } NS_IMETHODIMP -LocalStoreImpl::IsCommandEnabled(nsISupportsArray/**/* aSources, +LocalStoreImpl::IsCommandEnabled(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, + nsISupports* aArguments, bool* aResult) { - *aResult = true; - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -LocalStoreImpl::DoCommand(nsISupportsArray* aSources, +LocalStoreImpl::DoCommand(nsISupports* aSources, nsIRDFResource* aCommand, - nsISupportsArray* aArguments) + nsISupports* aArguments) { - // no-op - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP diff --git a/xpfe/components/directory/nsDirectoryViewer.cpp b/xpfe/components/directory/nsDirectoryViewer.cpp index d9e4820f268f..9d23c5e7464c 100644 --- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -1188,27 +1188,17 @@ nsHTTPIndex::GetAllResources(nsISimpleEnumerator **_retval) } NS_IMETHODIMP -nsHTTPIndex::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, - nsISupportsArray *aArguments, bool *_retval) +nsHTTPIndex::IsCommandEnabled(nsISupports *aSources, nsIRDFResource *aCommand, + nsISupports *aArguments, bool *_retval) { - nsresult rv = NS_ERROR_UNEXPECTED; - if (mInner) - { - rv = mInner->IsCommandEnabled(aSources, aCommand, aArguments, _retval); - } - return(rv); + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -nsHTTPIndex::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, - nsISupportsArray *aArguments) +nsHTTPIndex::DoCommand(nsISupports *aSources, nsIRDFResource *aCommand, + nsISupports *aArguments) { - nsresult rv = NS_ERROR_UNEXPECTED; - if (mInner) - { - rv = mInner->DoCommand(aSources, aCommand, aArguments); - } - return(rv); + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP diff --git a/xpfe/components/windowds/nsWindowDataSource.cpp b/xpfe/components/windowds/nsWindowDataSource.cpp index cdeb3a134238..3e7a42060788 100644 --- a/xpfe/components/windowds/nsWindowDataSource.cpp +++ b/xpfe/components/windowds/nsWindowDataSource.cpp @@ -443,18 +443,14 @@ NS_IMETHODIMP nsWindowDataSource::GetAllResources(nsISimpleEnumerator **_retval) return NS_OK; } -NS_IMETHODIMP nsWindowDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, bool *_retval) +NS_IMETHODIMP nsWindowDataSource::IsCommandEnabled(nsISupports *aSources, nsIRDFResource *aCommand, nsISupports *aArguments, bool *_retval) { - if (mInner) - return mInner->IsCommandEnabled(aSources, aCommand, aArguments, _retval); - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP nsWindowDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments) +NS_IMETHODIMP nsWindowDataSource::DoCommand(nsISupports *aSources, nsIRDFResource *aCommand, nsISupports *aArguments) { - if (mInner) - return mInner->DoCommand(aSources, aCommand, aArguments); - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsWindowDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)