From 3debcecb460ada125444c53bf8f3da97135fd8fe Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 17 Aug 2018 10:26:25 -0400 Subject: [PATCH] Bug 1484109 - Part 1: Remove the XPCOM component registration for nsRelativeFilePref; r=njn --- modules/libpref/Preferences.cpp | 12 +++------- modules/libpref/nsIRelativeFilePref.idl | 31 ------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index 065abe470ac9..b7d4cdd075d7 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -2668,11 +2668,9 @@ nsPrefBranch::GetComplexValue(const char* aPrefName, return rv; } - nsCOMPtr relativePref; - rv = NS_NewRelativeFilePref(theFile, key, getter_AddRefs(relativePref)); - if (NS_FAILED(rv)) { - return rv; - } + nsCOMPtr relativePref = new nsRelativeFilePref(); + Unused << relativePref->SetFile(theFile); + Unused << relativePref->SetRelativeToKey(key); relativePref.forget(reinterpret_cast(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 } }; diff --git a/modules/libpref/nsIRelativeFilePref.idl b/modules/libpref/nsIRelativeFilePref.idl index 4b86e3755836..5863d52472d5 100644 --- a/modules/libpref/nsIRelativeFilePref.idl +++ b/modules/libpref/nsIRelativeFilePref.idl @@ -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 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; -} - -%}