Make protocol handling dialog appear with protocols that are unknown to the OS if we have handlers (
bug 392964), r=myk,biesi; sr=biesi; a=mconnor
Make protocol handling dialog appear with protocols that are unknown to the OS if we have handlers (
bug 392964), r=myk,biesi; sr=biesi; a=mconnor
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -691,20 +691,23 @@ nsresult nsExternalHelperAppService::Get
NS_IMETHODIMP nsExternalHelperAppService::ExternalProtocolHandlerExists(const char * aProtocolScheme,
PRBool * aHandlerExists)
{
nsCOMPtr<nsIHandlerInfo> handlerInfo;
nsresult rv = GetProtocolHandlerInfo(
nsDependentCString(aProtocolScheme), getter_AddRefs(handlerInfo));
NS_ENSURE_SUCCESS(rv, rv);
- // See if we have a preferred handler app for this
- nsCOMPtr<nsIHandlerApp> preferredApp;
- handlerInfo->GetPreferredApplicationHandler(getter_AddRefs(preferredApp));
- if (preferredApp) {
+ // See if we have any known possible handler apps for this
+ nsCOMPtr<nsIMutableArray> possibleHandlers;
+ handlerInfo->GetPossibleApplicationHandlers(getter_AddRefs(possibleHandlers));
+
+ PRUint32 length;
+ possibleHandlers->GetLength(&length);
+ if (length) {
*aHandlerExists = PR_TRUE;
return NS_OK;
}
// if not, fall back on an os-based handler
return OSProtocolHandlerExists(aProtocolScheme, aHandlerExists);
}
--- a/uriloader/exthandler/nsIExternalProtocolService.idl
+++ b/uriloader/exthandler/nsIExternalProtocolService.idl
@@ -54,19 +54,24 @@ interface nsIHandlerInfo;
* You can ask the external protocol service if it has an external
* handler for a given protocol scheme. And you can ask it to load
* the url using the default handler.
*/
[scriptable, uuid(7968ffa9-bb51-4b2d-aad2-8ea46c15d27f)]
interface nsIExternalProtocolService : nsISupports
{
/**
- * Check whether a handler for a specific protocol exists.
+ * Check whether a handler for a specific protocol exists. Specifically,
+ * this looks to see whether there are any known possible application handlers
+ * in either the nsIHandlerService datastore or registered with the OS.
+ *
* @param aProtocolScheme The scheme from a url: http, ftp, mailto, etc.
+ *
* @return true if we have a handler and false otherwise.
+ *
* XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?
*/
boolean externalProtocolHandlerExists(in string aProtocolScheme);
/**
* Check whether a handler for a specific protocol is "exposed" as a visible
* feature of the current application.
*