Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part E, remove uses of nsIPrefBranch2 in netwerk/ ; r=bsmedberg

This commit is contained in:
Geoff Lankow 2012-01-17 14:48:29 +13:00
Родитель 8c5fdd1d03
Коммит ffee27c39f
15 изменённых файлов: 26 добавлений и 33 удалений

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

@ -54,7 +54,6 @@
#include "netCore.h"
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefLocalizedString.h"
#include "nsICategoryManager.h"
#include "nsXPCOM.h"
@ -222,7 +221,7 @@ nsIOService::Init()
mRestrictedPortList.AppendElement(gBadPortList[i]);
// Further modifications to the port list come from prefs
nsCOMPtr<nsIPrefBranch2> prefBranch;
nsCOMPtr<nsIPrefBranch> prefBranch;
GetPrefBranch(getter_AddRefs(prefBranch));
if (prefBranch) {
prefBranch->AddObserver(PORT_PREF_PREFIX, this, true);
@ -441,7 +440,7 @@ nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result)
return rv;
bool externalProtocol = false;
nsCOMPtr<nsIPrefBranch2> prefBranch;
nsCOMPtr<nsIPrefBranch> prefBranch;
GetPrefBranch(getter_AddRefs(prefBranch));
if (prefBranch) {
nsCAutoString externalProtocolPref("network.protocol-handler.external.");
@ -962,7 +961,7 @@ nsIOService::ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool rem
}
void
nsIOService::GetPrefBranch(nsIPrefBranch2 **result)
nsIOService::GetPrefBranch(nsIPrefBranch **result)
{
*result = nsnull;
CallGetService(NS_PREFSERVICE_CONTRACTID, result);

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

@ -70,7 +70,6 @@ static const char gScheme[][sizeof("resource")] =
{"chrome", "file", "http", "jar", "resource"};
class nsIPrefBranch;
class nsIPrefBranch2;
class nsIOService : public nsIIOService2
, public nsIObserver
@ -130,7 +129,7 @@ private:
// Prefs wrangling
NS_HIDDEN_(void) PrefsChanged(nsIPrefBranch *prefs, const char *pref = nsnull);
NS_HIDDEN_(void) GetPrefBranch(nsIPrefBranch2 **);
NS_HIDDEN_(void) GetPrefBranch(nsIPrefBranch **);
NS_HIDDEN_(void) ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool remove);
nsresult InitializeSocketTransportService();

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

@ -52,7 +52,7 @@
#include "nsICancelable.h"
#include "nsIDNSService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsReadableUtils.h"
#include "nsThreadUtils.h"
#include "nsString.h"
@ -340,7 +340,7 @@ nsProtocolProxyService::Init()
return NS_ERROR_OUT_OF_MEMORY;
// failure to access prefs is non-fatal
nsCOMPtr<nsIPrefBranch2> prefBranch =
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefBranch) {
// monitor proxy prefs

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

@ -48,7 +48,7 @@
#include "prerror.h"
#include "plstr.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsServiceManagerUtils.h"
#include "nsIOService.h"
@ -494,7 +494,7 @@ nsSocketTransportService::Init()
thread.swap(mThread);
}
nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (tmpPrefService)
tmpPrefService->AddObserver(SEND_BUFFER_PREF, this, false);
UpdatePrefs();
@ -539,7 +539,7 @@ nsSocketTransportService::Shutdown()
mThread = nsnull;
}
nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (tmpPrefService)
tmpPrefService->RemoveObserver(SEND_BUFFER_PREF, this);
@ -818,7 +818,7 @@ nsSocketTransportService::UpdatePrefs()
{
mSendBufferSize = 0;
nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (tmpPrefService) {
PRInt32 bufferSize;
nsresult rv = tmpPrefService->GetIntPref(SEND_BUFFER_PREF, &bufferSize);

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

@ -51,7 +51,6 @@
#include "nsICharsetConverterManager.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIIDNService.h"
#include "nsNetUtil.h"
#include "prlog.h"
@ -342,7 +341,7 @@ DumpLeakedURLs::~DumpLeakedURLs()
void
nsStandardURL::InitGlobalObjects()
{
nsCOMPtr<nsIPrefBranch2> prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) );
nsCOMPtr<nsIPrefBranch> prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) );
if (prefBranch) {
nsCOMPtr<nsIObserver> obs( new nsPrefObserver() );
prefBranch->AddObserver(NS_NET_PREF_ESCAPEUTF8, obs.get(), false);

7
netwerk/cache/nsCacheService.cpp поставляемый
Просмотреть файл

@ -60,7 +60,6 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsILocalFile.h"
#include "nsIOService.h"
#include "nsDirectoryServiceDefs.h"
@ -264,7 +263,7 @@ public:
nsCacheService::SetDiskCacheCapacity(mSmartSize);
nsCOMPtr<nsIPrefBranch2> ps = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> ps = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!ps ||
NS_FAILED(ps->SetIntPref(DISK_CACHE_SMART_SIZE_PREF, mSmartSize)))
NS_WARNING("Failed to set smart size pref");
@ -336,7 +335,7 @@ nsCacheProfilePrefObserver::Install()
}
// install preferences observer
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!branch) return NS_ERROR_FAILURE;
for (unsigned int i=0; i<ArrayLength(prefList); i++) {
@ -384,7 +383,7 @@ nsCacheProfilePrefObserver::Remove()
}
// remove Pref Service observers
nsCOMPtr<nsIPrefBranch2> prefs =
nsCOMPtr<nsIPrefBranch> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return;

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

@ -40,7 +40,7 @@
#include "mozilla/net/NeckoChild.h"
#include "nsIURI.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
namespace mozilla {
namespace net {
@ -86,7 +86,7 @@ CookieServiceChild::CookieServiceChild()
gNeckoChild->SendPCookieServiceConstructor(this);
// Init our prefs and observer.
nsCOMPtr<nsIPrefBranch2> prefBranch =
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID);
NS_WARN_IF_FALSE(prefBranch, "no prefservice");
if (prefBranch) {

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

@ -53,7 +53,6 @@
#include "nsIIOService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
#include "nsICookiePermission.h"
#include "nsIURI.h"
@ -631,7 +630,7 @@ nsCookieService::Init()
NS_ENSURE_SUCCESS(rv, rv);
// init our pref and observer
nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefBranch) {
prefBranch->AddObserver(kPrefCookieBehavior, this, true);
prefBranch->AddObserver(kPrefMaxNumberOfCookies, this, true);

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

@ -41,7 +41,6 @@
#include "nsICancelable.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIServiceManager.h"
#include "nsProxyRelease.h"
#include "nsReadableUtils.h"
@ -409,7 +408,7 @@ nsDNSService::Init()
nsAdoptingCString ipv4OnlyDomains;
// read prefs
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRInt32 val;
if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheEntries, &val)))

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

@ -43,7 +43,6 @@
#include "nsIServiceManager.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIObserverService.h"
#include "nsISupportsPrimitives.h"
#include "punycode.h"
@ -87,7 +86,7 @@ nsresult nsIDNService::Init()
if (prefs)
prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch));
nsCOMPtr<nsIPrefBranch2> prefInternal(do_QueryInterface(prefs));
nsCOMPtr<nsIPrefBranch> prefInternal(do_QueryInterface(prefs));
if (prefInternal) {
prefInternal->AddObserver(NS_NET_PREF_IDNTESTBED, this, true);
prefInternal->AddObserver(NS_NET_PREF_IDNPREFIX, this, true);

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

@ -66,7 +66,7 @@ using namespace mozilla::net;
#include "prlog.h"
#include "nsNetUtil.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIObserverService.h"
#include "nsEscape.h"
#include "nsAlgorithm.h"
@ -140,7 +140,7 @@ nsFtpProtocolHandler::Init()
if (mIdleTimeout == -1) {
nsresult rv;
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
rv = branch->GetIntPref(IDLE_TIMEOUT_PREF, &mIdleTimeout);

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

@ -62,7 +62,7 @@
#include "nsCategoryManagerUtils.h"
#include "nsICacheService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIPrefLocalizedString.h"
#include "nsISocketProviderService.h"
#include "nsISocketProvider.h"
@ -258,7 +258,7 @@ nsHttpHandler::Init()
InitUserAgentComponents();
// monitor some preference changes
nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefBranch) {
prefBranch->AddObserver(HTTP_PREF_PREFIX, this, true);
prefBranch->AddObserver(UA_PREF_PREFIX, this, true);

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

@ -29,7 +29,7 @@ function expected_fail(inputIDN)
function run_test() {
// add an IDN whitelist pref
var pbi = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch2);
.getService(Ci.nsIPrefBranch);
pbi.setBoolPref("network.IDN.whitelist.com", true);
idnService = Cc["@mozilla.org/network/idn-service;1"]

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

@ -29,7 +29,7 @@ function expected_fail(inputIDN)
function run_test() {
// add an IDN whitelist pref
var pbi = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch2);
.getService(Ci.nsIPrefBranch);
var whitelistPref = "network.IDN.whitelist.com";
pbi.setBoolPref(whitelistPref, true);

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

@ -25,7 +25,7 @@ function run_test() {
// add an IDN whitelist pref
var pbi = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
pbi.setBoolPref("network.IDN.whitelist.es", true);
// check convertToDisplayIDN against the whitelist