External protocol handler support via preference of form "network.protocol-handler.external.scheme".

bug #133386, r=gordon, sr=darin, a=valeski


git-svn-id: svn://10.0.0.236/trunk@117491 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com
2002-03-26 15:58:26 +00:00
parent 51ebc45f34
commit 06e944d6da

View File

@@ -415,12 +415,26 @@ nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result)
rv = GetCachedProtocolHandler(scheme, result);
if (NS_SUCCEEDED(rv)) return NS_OK;
nsCAutoString contractID(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX);
contractID += scheme;
ToLowerCase(contractID);
PRBool externalProtocol = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefBranch;
GetPrefBranch(getter_AddRefs(prefBranch));
if (prefBranch) {
nsCAutoString externalProtocolPref("network.protocol-handler.external.");
externalProtocolPref += scheme;
rv = prefBranch->GetBoolPref(externalProtocolPref.get(), &externalProtocol);
if (NS_FAILED(rv))
externalProtocol = PR_FALSE;
}
rv = CallGetService(contractID.get(), result);
if (NS_FAILED(rv))
if (!externalProtocol) {
nsCAutoString contractID(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX);
contractID += scheme;
ToLowerCase(contractID);
rv = CallGetService(contractID.get(), result);
}
if (externalProtocol || NS_FAILED(rv))
{
// okay we don't have a protocol handler to handle this url type, so use the default protocol handler.
// this will cause urls to get dispatched out to the OS ('cause we can't do anything with them) when