From ea3834fbff13c4c138ee4e9710362dc7fdd96ca8 Mon Sep 17 00:00:00 2001 From: Liang-Heng Chen Date: Thu, 27 Jul 2017 19:10:21 +0800 Subject: [PATCH] Bug 1379872 - early initialize ProtocolProxyService; r=bagder MozReview-Commit-ID: Kv7cVYhmLJn --HG-- extra : rebase_source : e1b89084906f7dfa133a6ba7c0b1c5873571056c --- netwerk/base/nsIOService.cpp | 15 +++++++++++++++ netwerk/base/nsIOService.h | 1 + 2 files changed, 16 insertions(+) diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 122d8c3a176b..b2078b4565fe 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -54,6 +54,7 @@ #include "mozilla/net/NeckoChild.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/net/CaptivePortalService.h" +#include "mozilla/Unused.h" #include "ReferrerPolicy.h" #include "nsContentSecurityManager.h" #include "nsContentUtils.h" @@ -258,6 +259,7 @@ nsIOService::Init() gIOService = this; InitializeNetworkLinkService(); + InitializeProtocolProxyService(); SetOffline(false); @@ -336,6 +338,19 @@ nsIOService::InitializeNetworkLinkService() return rv; } +nsresult +nsIOService::InitializeProtocolProxyService() +{ + nsresult rv = NS_OK; + + if (XRE_IsParentProcess()) { + // for early-initialization + Unused << do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + } + + return rv; +} + nsIOService* nsIOService::GetInstance() { if (!gIOService) { diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index 5de5dd8af3ae..995fae228f64 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -136,6 +136,7 @@ private: nsresult InitializeSocketTransportService(); nsresult InitializeNetworkLinkService(); + nsresult InitializeProtocolProxyService(); // consolidated helper function void LookupProxyInfo(nsIURI *aURI, nsIURI *aProxyURI, uint32_t aProxyFlags,