Bug 1348278 - Limit speculative connections to http[s] only. r?mcmanus
Some protocol handlers don't handle speculative connections too well
(they crash). So, we limit to the most useful protocols. This patch
brought to you by
https://bugzilla.mozilla.org/show_bug.cgi?id=1348278#c21
MozReview-Commit-ID: 8dWGdVtalIS
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -1789,16 +1789,23 @@ IOServiceProxyCallback::OnProxyAvailable
}
nsresult
nsIOService::SpeculativeConnectInternal(nsIURI *aURI,
nsIPrincipal *aPrincipal,
nsIInterfaceRequestor *aCallbacks,
bool aAnonymous)
{
+ bool isHTTP, isHTTPS;
+ if (!(NS_SUCCEEDED(aURI->SchemeIs("http", &isHTTP)) && isHTTP) &&
+ !(NS_SUCCEEDED(aURI->SchemeIs("https", &isHTTPS)) && isHTTPS)) {
+ // We don't speculatively connect to non-HTTP[S] URIs.
+ return NS_OK;
+ }
+
if (IsNeckoChild()) {
ipc::URIParams params;
SerializeURI(aURI, params);
gNeckoChild->SendSpeculativeConnect(params,
IPC::Principal(aPrincipal),
aAnonymous);
return NS_OK;
}