Bug 1484109 - Part 1: Remove the XPCOM component registration for nsRelativeFilePref; r=njn

This commit is contained in:
Ehsan Akhgari 2018-08-17 10:26:25 -04:00
Родитель ff402b25e1
Коммит 3debcecb46
2 изменённых файлов: 3 добавлений и 40 удалений

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

@ -2668,11 +2668,9 @@ nsPrefBranch::GetComplexValue(const char* aPrefName,
return rv;
}
nsCOMPtr<nsIRelativeFilePref> relativePref;
rv = NS_NewRelativeFilePref(theFile, key, getter_AddRefs(relativePref));
if (NS_FAILED(rv)) {
return rv;
}
nsCOMPtr<nsIRelativeFilePref> relativePref = new nsRelativeFilePref();
Unused << relativePref->SetFile(theFile);
Unused << relativePref->SetRelativeToKey(key);
relativePref.forget(reinterpret_cast<nsIRelativeFilePref**>(aRetVal));
return NS_OK;
@ -6085,11 +6083,9 @@ StaticPrefs::InitAll(bool aIsStartup)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
Preferences::GetInstanceForService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref)
static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
static mozilla::Module::CIDEntry kPrefCIDs[] = {
{ &kPrefServiceCID, true, nullptr, PreferencesConstructor },
@ -6097,14 +6093,12 @@ static mozilla::Module::CIDEntry kPrefCIDs[] = {
false,
nullptr,
nsPrefLocalizedStringConstructor },
{ &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
{ nullptr }
};
static mozilla::Module::ContractIDEntry kPrefContracts[] = {
{ NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID },
{ NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID },
{ NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID },
{ nullptr }
};

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

@ -36,34 +36,3 @@ interface nsIRelativeFilePref : nsISupports
attribute ACString relativeToKey;
};
%{C++
#define NS_RELATIVEFILEPREF_CID \
{ /* {2f977d4f-5485-11d4-87e2-0010a4e75ef2} */ \
0x2f977d4f, \
0x5485, \
0x11d4, \
{ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 } \
}
#define NS_RELATIVEFILEPREF_CONTRACTID "@mozilla.org/pref-relativefile;1"
#include "nsComponentManagerUtils.h"
inline nsresult
NS_NewRelativeFilePref(nsIFile* aFile, const nsACString& relativeToKey, nsIRelativeFilePref** result)
{
nsresult rv;
nsCOMPtr<nsIRelativeFilePref> local(do_CreateInstance(NS_RELATIVEFILEPREF_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
(void)local->SetFile(aFile);
(void)local->SetRelativeToKey(relativeToKey);
*result = local;
NS_ADDREF(*result);
return NS_OK;
}
%}