Bug 1447341 - stop querying prefs for fake protocols we use internally, r?hurley
MozReview-Commit-ID: EXUupEKlsSM
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -517,16 +517,22 @@ UsesExternalProtocolHandler(const char*
NS_LITERAL_CSTRING("chrome").Equals(aScheme) ||
NS_LITERAL_CSTRING("resource").Equals(aScheme)) {
// Don't allow file:, chrome: or resource: URIs to be handled with
// nsExternalProtocolHandler, since internally we rely on being able to
// use and read from these URIs.
return false;
}
+ for (unsigned int i = 0; i < NS_N(gForcedExternalSchemes); i++) {
+ if (!nsCRT::strcasecmp(gForcedExternalSchemes[i], aScheme)) {
+ return true;
+ }
+ }
+
nsAutoCString pref("network.protocol-handler.external.");
pref += aScheme;
return Preferences::GetBool(pref.get(), false);
}
NS_IMETHODIMP
nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result)
--- a/netwerk/base/nsIOService.h
+++ b/netwerk/base/nsIOService.h
@@ -30,16 +30,19 @@
// See Bug 552829
#define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline"
#define NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC "ipc:network:set-connectivity"
static const char gScheme[][sizeof("moz-safe-about")] =
{"chrome", "file", "http", "https", "jar", "data", "about", "moz-safe-about", "resource",
"moz-extension", "page-icon", "blob"};
+static const char gForcedExternalSchemes[][sizeof("moz-nullprincipal")] =
+ {"place", "fake-favicon-uri", "favicon", "moz-nullprincipal"};
+
class nsINetworkLinkService;
class nsIPrefBranch;
class nsIProtocolProxyService2;
class nsIProxyInfo;
class nsPISocketTransportService;
namespace mozilla {
namespace net {