Bug 1447341 - stop querying prefs for fake protocols we use internally, r=nwgh
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 17 Apr 2018 15:48:13 +0100
changeset 414275 5d965c4d39f512e6ec78df74938d1ef2ef1a0030
parent 414274 8b951bb045214b011120d5d6f3a20991dc99d021
child 414276 697d0f7076eb03cc8a5f18856616d80e5ebf9a55
push id33862
push userdluca@mozilla.com
push dateWed, 18 Apr 2018 16:55:46 +0000
treeherdermozilla-central@697d0f7076eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnwgh
bugs1447341
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1447341 - stop querying prefs for fake protocols we use internally, r=nwgh MozReview-Commit-ID: EXUupEKlsSM
netwerk/base/nsIOService.cpp
netwerk/base/nsIOService.h
--- 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 {