зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1640105
- Initialize necessary services eariler r=dragana
Initialize http handler, DNS service, and IOService earlier to avoid crash. Differential Revision: https://phabricator.services.mozilla.com/D77303
This commit is contained in:
Родитель
690f9999cd
Коммит
dad33c111e
|
@ -123,6 +123,26 @@ bool SocketProcessChild::Init(base::ProcessId aParentPid,
|
|||
// because it's not running a native event loop. See bug 1384336.
|
||||
CGSShutdownServerConnections();
|
||||
#endif // XP_MACOSX
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = ios->GetProtocolHandler("http", getter_AddRefs(handler));
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize DNS Service here, since it needs to be done in main thread.
|
||||
nsCOMPtr<nsIDNSService> dns =
|
||||
do_GetService("@mozilla.org/network/dns-service;1", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -313,31 +333,8 @@ PFileDescriptorSetChild* SocketProcessChild::SendPFileDescriptorSetConstructor(
|
|||
already_AddRefed<PHttpConnectionMgrChild>
|
||||
SocketProcessChild::AllocPHttpConnectionMgrChild() {
|
||||
LOG(("SocketProcessChild::AllocPHttpConnectionMgrChild \n"));
|
||||
if (!gHttpHandler) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = ios->GetProtocolHandler("http", getter_AddRefs(handler));
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Initialize DNS Service here, since it needs to be done in main thread.
|
||||
nsCOMPtr<nsIDNSService> dns =
|
||||
do_GetService("@mozilla.org/network/dns-service;1", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<HttpConnectionMgrChild> actor = new HttpConnectionMgrChild();
|
||||
return actor.forget();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
RefPtr<HttpConnectionMgrChild> actor = new HttpConnectionMgrChild();
|
||||
return actor.forget();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
|
Загрузка…
Ссылка в новой задаче