Bug 1418752 - Firefox instahang on start after landing patch from bug #1392841.vr=honzab

Initialize in advance all security services whose initialization on background thread could cause a deadlock.
This commit is contained in:
Michal Novotny
2017-12-19 21:08:15 -05:00
parent 2264dd6fbf
commit ba1765dd4d
2 changed files with 10 additions and 0 deletions

View File

@@ -75,6 +75,8 @@
#include "nsHttpHandler.h"
#include "nsNSSComponent.h"
#include "nsIRedirectHistoryEntry.h"
#include "nsICertBlocklist.h"
#include "nsICertOverrideService.h"
#include <limits>
@@ -2659,6 +2661,10 @@ void net_EnsurePSMInit()
nsresult rv;
nsCOMPtr<nsISupports> psm = do_GetService(PSM_COMPONENT_CONTRACTID, &rv);
MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsISupports> sss = do_GetService(NS_SSSERVICE_CONTRACTID);
nsCOMPtr<nsISupports> cbl = do_GetService(NS_CERTBLOCKLIST_CONTRACTID);
nsCOMPtr<nsISupports> cos = do_GetService(NS_CERTOVERRIDE_CONTRACTID);
}
bool NS_IsAboutBlank(nsIURI *uri)

View File

@@ -162,6 +162,10 @@ NS_DEFINE_NAMED_CID(NS_SECURE_BROWSER_UI_CID);
NS_DEFINE_NAMED_CID(NS_SITE_SECURITY_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_CERT_BLOCKLIST_CID);
// Components that require main thread initialization could cause a deadlock
// in necko code (bug 1418752). To prevent it we initialize all such components
// on main thread in advance in net_EnsurePSMInit(). Update that function when
// new component with ThreadRestriction::MainThreadOnly is added.
static const mozilla::Module::CIDEntry kNSSCIDs[] = {
{ &kNS_NSSCOMPONENT_CID, false, nullptr, nsNSSComponentConstructor },
{ &kNS_SSLSOCKETPROVIDER_CID, false, nullptr,