Bug 1491574 - Part 2: Remove the XPCOM registration for nsPersistentProperties; r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D5950
This commit is contained in:
Ehsan Akhgari 2018-09-15 12:58:31 -04:00
Родитель 9aa38967b7
Коммит 5d9d4af0cd
15 изменённых файлов: 30 добавлений и 54 удалений

Просмотреть файл

@ -65,6 +65,7 @@
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsWhitespaceTokenizer.h" #include "nsWhitespaceTokenizer.h"
#include "nsAttrName.h" #include "nsAttrName.h"
#include "nsPersistentProperties.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/BasicEvents.h" #include "mozilla/BasicEvents.h"
@ -1019,8 +1020,7 @@ Accessible::Attributes()
already_AddRefed<nsIPersistentProperties> already_AddRefed<nsIPersistentProperties>
Accessible::NativeAttributes() Accessible::NativeAttributes()
{ {
nsCOMPtr<nsIPersistentProperties> attributes = RefPtr<nsPersistentProperties> attributes = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
nsAutoString unused; nsAutoString unused;

Просмотреть файл

@ -25,7 +25,7 @@
#include "nsFrameSelection.h" #include "nsFrameSelection.h"
#include "nsILineIterator.h" #include "nsILineIterator.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIPersistentProperties2.h" #include "nsPersistentProperties.h"
#include "nsIScrollableFrame.h" #include "nsIScrollableFrame.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsITextControlElement.h" #include "nsITextControlElement.h"
@ -880,8 +880,7 @@ HyperTextAccessible::TextAttributes(bool aIncludeDefAttrs, int32_t aOffset,
return nullptr; return nullptr;
} }
nsCOMPtr<nsIPersistentProperties> attributes = RefPtr<nsPersistentProperties> attributes = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
Accessible* accAtOffset = GetChildAtOffset(offset); Accessible* accAtOffset = GetChildAtOffset(offset);
if (!accAtOffset) { if (!accAtOffset) {
@ -925,8 +924,7 @@ HyperTextAccessible::TextAttributes(bool aIncludeDefAttrs, int32_t aOffset,
already_AddRefed<nsIPersistentProperties> already_AddRefed<nsIPersistentProperties>
HyperTextAccessible::DefaultTextAttributes() HyperTextAccessible::DefaultTextAttributes()
{ {
nsCOMPtr<nsIPersistentProperties> attributes = RefPtr<nsPersistentProperties> attributes = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
TextAttrsMgr textAttrsMgr(this); TextAttrsMgr textAttrsMgr(this);
textAttrsMgr.GetAttributes(attributes); textAttrsMgr.GetAttributes(attributes);

Просмотреть файл

@ -11,7 +11,7 @@
#include "IUnknownImpl.h" #include "IUnknownImpl.h"
#include "nsIGfxInfo.h" #include "nsIGfxInfo.h"
#include "nsIPersistentProperties2.h" #include "nsPersistentProperties.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
@ -26,8 +26,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(ApplicationAccessibleWrap,
already_AddRefed<nsIPersistentProperties> already_AddRefed<nsIPersistentProperties>
ApplicationAccessibleWrap::NativeAttributes() ApplicationAccessibleWrap::NativeAttributes()
{ {
nsCOMPtr<nsIPersistentProperties> attributes = RefPtr<nsPersistentProperties> attributes = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo(); nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) { if (gfxInfo) {

Просмотреть файл

@ -16,7 +16,7 @@
#include "xpcAccessibleDocument.h" #include "xpcAccessibleDocument.h"
#include "nsIMutableArray.h" #include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h" #include "nsPersistentProperties.h"
using namespace mozilla::a11y; using namespace mozilla::a11y;
@ -416,8 +416,7 @@ xpcAccessible::GetAttributes(nsIPersistentProperties** aAttributes)
AutoTArray<Attribute, 10> attrs; AutoTArray<Attribute, 10> attrs;
proxy->Attributes(&attrs); proxy->Attributes(&attrs);
nsCOMPtr<nsIPersistentProperties> props = RefPtr<nsPersistentProperties> props = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
uint32_t attrCount = attrs.Length(); uint32_t attrCount = attrs.Length();
nsAutoString unused; nsAutoString unused;
for (uint32_t i = 0; i < attrCount; i++) { for (uint32_t i = 0; i < attrCount; i++) {

Просмотреть файл

@ -18,7 +18,7 @@
#include "nsIBoxObject.h" #include "nsIBoxObject.h"
#include "nsIMutableArray.h" #include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h" #include "nsPersistentProperties.h"
#include "nsITreeSelection.h" #include "nsITreeSelection.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
@ -646,8 +646,7 @@ XULTreeGridCellAccessible::Selected()
already_AddRefed<nsIPersistentProperties> already_AddRefed<nsIPersistentProperties>
XULTreeGridCellAccessible::NativeAttributes() XULTreeGridCellAccessible::NativeAttributes()
{ {
nsCOMPtr<nsIPersistentProperties> attributes = RefPtr<nsPersistentProperties> attributes = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
// "table-cell-index" attribute // "table-cell-index" attribute
TableAccessible* table = Table(); TableAccessible* table = Table();

Просмотреть файл

@ -17,6 +17,7 @@ interface nsICycleCollectorListener;
interface nsIEditorSpellCheck; interface nsIEditorSpellCheck;
interface nsIFile; interface nsIFile;
interface nsILoadContext; interface nsILoadContext;
interface nsIPersistentProperties;
interface nsIURI; interface nsIURI;
interface nsIJSCID; interface nsIJSCID;
interface nsIJSIID; interface nsIJSIID;
@ -731,6 +732,9 @@ interface nsIXPCComponents_Utils : nsISupports
/* Create a private loadcontext object. */ /* Create a private loadcontext object. */
nsILoadContext createPrivateLoadContext(); nsILoadContext createPrivateLoadContext();
/* Create a persistent property object. */
nsIPersistentProperties createPersistentProperties();
}; };
/** /**

Просмотреть файл

@ -44,7 +44,7 @@
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#include "mozilla/EditorSpellCheck.h" #include "mozilla/EditorSpellCheck.h"
#include "nsCommandLine.h" #include "nsCommandLine.h"
#include "nsCommandParams.h" #include "nsPersistentProperties.h"
using namespace mozilla; using namespace mozilla;
using namespace JS; using namespace JS;
@ -3251,6 +3251,15 @@ nsXPCComponents_Utils::CreatePrivateLoadContext(nsILoadContext** aLoadContext)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsXPCComponents_Utils::CreatePersistentProperties(nsIPersistentProperties** aPersistentProperties)
{
NS_ENSURE_ARG_POINTER(aPersistentProperties);
nsCOMPtr<nsIPersistentProperties> props = new nsPersistentProperties();
props.forget(aPersistentProperties);
return NS_OK;
}
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/

Просмотреть файл

@ -44,7 +44,7 @@
#include "nsINode.h" #include "nsINode.h"
#include "nsIObjectLoadingContent.h" #include "nsIObjectLoadingContent.h"
#include "nsIOfflineCacheUpdate.h" #include "nsIOfflineCacheUpdate.h"
#include "nsIPersistentProperties2.h" #include "nsPersistentProperties.h"
#include "nsIPrivateBrowsingChannel.h" #include "nsIPrivateBrowsingChannel.h"
#include "nsIPropertyBag2.h" #include "nsIPropertyBag2.h"
#include "nsIProtocolProxyService.h" #include "nsIProtocolProxyService.h"
@ -2029,9 +2029,7 @@ NS_LoadPersistentPropertiesFromURISpec(nsIPersistentProperties **outResult,
rv = channel->Open2(getter_AddRefs(in)); rv = channel->Open2(getter_AddRefs(in));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> properties = nsCOMPtr<nsIPersistentProperties> properties = new nsPersistentProperties();
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = properties->Load(in); rv = properties->Load(in);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -28,7 +28,6 @@
#include "nsCycleCollector.h" #include "nsCycleCollector.h"
#include "nsObserverList.h" #include "nsObserverList.h"
#include "nsObserverService.h" #include "nsObserverService.h"
#include "nsPersistentProperties.h"
#include "nsScriptableInputStream.h" #include "nsScriptableInputStream.h"
#include "nsBinaryStream.h" #include "nsBinaryStream.h"
#include "nsStorageStream.h" #include "nsStorageStream.h"
@ -256,8 +255,6 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsChromeRegistry,
nsChromeRegistry::GetSingleton) nsChromeRegistry::GetSingleton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler) NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler)
#define NS_PERSISTENTPROPERTIES_CID NS_IPERSISTENTPROPERTIES_CID /* sigh */
static already_AddRefed<nsIFactory> static already_AddRefed<nsIFactory>
CreateINIParserFactory(const mozilla::Module& aModule, CreateINIParserFactory(const mozilla::Module& aModule,
const mozilla::Module::CIDEntry& aEntry) const mozilla::Module::CIDEntry& aEntry)

Просмотреть файл

@ -12,8 +12,6 @@
COMPONENT(SCRIPTABLEBASE64ENCODER, nsScriptableBase64EncoderConstructor) COMPONENT(SCRIPTABLEBASE64ENCODER, nsScriptableBase64EncoderConstructor)
COMPONENT(PIPE, nsPipeConstructor) COMPONENT(PIPE, nsPipeConstructor)
COMPONENT(PERSISTENTPROPERTIES, nsPersistentProperties::Create)
COMPONENT(ARRAY, nsArrayBase::XPCOMConstructor) COMPONENT(ARRAY, nsArrayBase::XPCOMConstructor)
COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor) COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor)
COMPONENT_M(OBSERVERSERVICE, nsObserverService::Create, Module::ALLOW_IN_GPU_PROCESS) COMPONENT_M(OBSERVERSERVICE, nsObserverService::Create, Module::ALLOW_IN_GPU_PROCESS)

Просмотреть файл

@ -61,6 +61,7 @@ EXPORTS += [
'nsInterfaceHashtable.h', 'nsInterfaceHashtable.h',
'nsJSThingHashtable.h', 'nsJSThingHashtable.h',
'nsMathUtils.h', 'nsMathUtils.h',
'nsPersistentProperties.h',
'nsPointerHashKeys.h', 'nsPointerHashKeys.h',
'nsProperties.h', 'nsProperties.h',
'nsQuickSort.h', 'nsQuickSort.h',

Просмотреть файл

@ -58,13 +58,3 @@ interface nsIPersistentProperties : nsIProperties
%} %}
}; };
%{C++
#define NS_IPERSISTENTPROPERTIES_CID \
{ 0x2245e573, 0x9464, 0x11d2, \
{ 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
#define NS_PERSISTENTPROPERTIES_CONTRACTID "@mozilla.org/persistent-properties;1"
%}

Просмотреть файл

@ -459,17 +459,6 @@ nsPersistentProperties::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
return aMallocSizeOf(this) + n; return aMallocSizeOf(this) + n;
} }
nsresult
nsPersistentProperties::Create(nsISupports* aOuter, REFNSIID aIID,
void** aResult)
{
if (aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
RefPtr<nsPersistentProperties> props = new nsPersistentProperties();
return props->QueryInterface(aIID, aResult);
}
NS_IMPL_ISUPPORTS(nsPersistentProperties, nsIPersistentProperties, nsIProperties) NS_IMPL_ISUPPORTS(nsPersistentProperties, nsIPersistentProperties, nsIProperties)
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -25,9 +25,6 @@ public:
NS_DECL_NSIPROPERTIES NS_DECL_NSIPROPERTIES
NS_DECL_NSIPERSISTENTPROPERTIES NS_DECL_NSIPERSISTENTPROPERTIES
static MOZ_MUST_USE nsresult
Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
private: private:

Просмотреть файл

@ -9,8 +9,7 @@ function run_test() {
}); });
var inp = channel.open2(); var inp = channel.open2();
var properties = Cc["@mozilla.org/persistent-properties;1"]. var properties = Cu.createPersistentProperties();
createInstance(Ci.nsIPersistentProperties);
properties.load(inp); properties.load(inp);
var value; var value;
@ -56,8 +55,7 @@ function run_test() {
}); });
inp = channel2.open2(); inp = channel2.open2();
var properties2 = Cc["@mozilla.org/persistent-properties;1"]. var properties2 = Cu.createPersistentProperties();
createInstance(Ci.nsIPersistentProperties);
try { try {
properties2.load(inp); properties2.load(inp);
do_throw("load() didn't fail"); do_throw("load() didn't fail");