Loading uriloader/exthandler/nsExternalHelperAppService.cpp +24 −5 Original line number Original line Diff line number Diff line Loading @@ -870,8 +870,32 @@ nsresult nsExternalHelperAppService::GetFileTokenForPath( ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// // begin external protocol service default implementation... // begin external protocol service default implementation... ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// static const char kExternalProtocolPrefPrefix[] = "network.protocol-handler.external."; static const char kExternalProtocolDefaultPref[] = "network.protocol-handler.external-default"; NS_IMETHODIMP nsExternalHelperAppService::ExternalProtocolHandlerExists( NS_IMETHODIMP nsExternalHelperAppService::ExternalProtocolHandlerExists( const char* aProtocolScheme, bool* aHandlerExists) { const char* aProtocolScheme, bool* aHandlerExists) { // Replicate the same check performed in LoadURI. // Deny load if the prefs say to do so nsAutoCString externalPref(kExternalProtocolPrefPrefix); externalPref += aProtocolScheme; bool allowLoad = false; *aHandlerExists = false; if (NS_FAILED(Preferences::GetBool(externalPref.get(), &allowLoad))) { // no scheme-specific value, check the default if (NS_FAILED( Preferences::GetBool(kExternalProtocolDefaultPref, &allowLoad))) { return NS_OK; // missing default pref } } if (!allowLoad) { return NS_OK; // explicitly denied } nsCOMPtr<nsIHandlerInfo> handlerInfo; nsCOMPtr<nsIHandlerInfo> handlerInfo; nsresult rv = GetProtocolHandlerInfo(nsDependentCString(aProtocolScheme), nsresult rv = GetProtocolHandlerInfo(nsDependentCString(aProtocolScheme), getter_AddRefs(handlerInfo)); getter_AddRefs(handlerInfo)); Loading Loading @@ -914,11 +938,6 @@ NS_IMETHODIMP nsExternalHelperAppService::IsExposedProtocol( return NS_OK; return NS_OK; } } static const char kExternalProtocolPrefPrefix[] = "network.protocol-handler.external."; static const char kExternalProtocolDefaultPref[] = "network.protocol-handler.external-default"; // static // static nsresult nsExternalHelperAppService::EscapeURI(nsIURI* aURI, nsIURI** aResult) { nsresult nsExternalHelperAppService::EscapeURI(nsIURI* aURI, nsIURI** aResult) { MOZ_ASSERT(aURI); MOZ_ASSERT(aURI); Loading Loading
uriloader/exthandler/nsExternalHelperAppService.cpp +24 −5 Original line number Original line Diff line number Diff line Loading @@ -870,8 +870,32 @@ nsresult nsExternalHelperAppService::GetFileTokenForPath( ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// // begin external protocol service default implementation... // begin external protocol service default implementation... ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// static const char kExternalProtocolPrefPrefix[] = "network.protocol-handler.external."; static const char kExternalProtocolDefaultPref[] = "network.protocol-handler.external-default"; NS_IMETHODIMP nsExternalHelperAppService::ExternalProtocolHandlerExists( NS_IMETHODIMP nsExternalHelperAppService::ExternalProtocolHandlerExists( const char* aProtocolScheme, bool* aHandlerExists) { const char* aProtocolScheme, bool* aHandlerExists) { // Replicate the same check performed in LoadURI. // Deny load if the prefs say to do so nsAutoCString externalPref(kExternalProtocolPrefPrefix); externalPref += aProtocolScheme; bool allowLoad = false; *aHandlerExists = false; if (NS_FAILED(Preferences::GetBool(externalPref.get(), &allowLoad))) { // no scheme-specific value, check the default if (NS_FAILED( Preferences::GetBool(kExternalProtocolDefaultPref, &allowLoad))) { return NS_OK; // missing default pref } } if (!allowLoad) { return NS_OK; // explicitly denied } nsCOMPtr<nsIHandlerInfo> handlerInfo; nsCOMPtr<nsIHandlerInfo> handlerInfo; nsresult rv = GetProtocolHandlerInfo(nsDependentCString(aProtocolScheme), nsresult rv = GetProtocolHandlerInfo(nsDependentCString(aProtocolScheme), getter_AddRefs(handlerInfo)); getter_AddRefs(handlerInfo)); Loading Loading @@ -914,11 +938,6 @@ NS_IMETHODIMP nsExternalHelperAppService::IsExposedProtocol( return NS_OK; return NS_OK; } } static const char kExternalProtocolPrefPrefix[] = "network.protocol-handler.external."; static const char kExternalProtocolDefaultPref[] = "network.protocol-handler.external-default"; // static // static nsresult nsExternalHelperAppService::EscapeURI(nsIURI* aURI, nsIURI** aResult) { nsresult nsExternalHelperAppService::EscapeURI(nsIURI* aURI, nsIURI** aResult) { MOZ_ASSERT(aURI); MOZ_ASSERT(aURI); Loading