diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 260deb01e4be..e060b0f8d66e 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -2048,6 +2048,11 @@ NS_IMETHODIMP nsHttpHandler::NewProxiedChannel(nsIURI* uri, nsIProxyInfo* givenProxyInfo, uint32_t proxyResolveFlags, nsIURI* proxyURI, nsILoadInfo* aLoadInfo, nsIChannel** result) { + // Avoid a late initialization + if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownNetTeardown)) { + return NS_ERROR_ILLEGAL_DURING_SHUTDOWN; + } + HttpBaseChannel* httpChannel; LOG(("nsHttpHandler::NewProxiedChannel [proxyInfo=%p]\n", givenProxyInfo)); @@ -2060,11 +2065,6 @@ nsHttpHandler::NewProxiedChannel(nsIURI* uri, nsIProxyInfo* givenProxyInfo, httpChannel = new nsHttpChannel(); } - // Avoid a late initialization - if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownNetTeardown)) { - return NS_ERROR_ILLEGAL_DURING_SHUTDOWN; - } - return SetupChannelInternal(httpChannel, uri, givenProxyInfo, proxyResolveFlags, proxyURI, aLoadInfo, result); }