$OpenBSD$ index 4544f1b..68ac197 100644 --- dom/plugins/base/nsPluginHost.cpp.orig Fri Feb 20 15:40:37 2015 +++ dom/plugins/base/nsPluginHost.cpp Fri Feb 20 15:40:37 2015 @@ -30,7 +30,7 @@ #include "nsIURL.h" #include "nsTArray.h" #include "nsReadableUtils.h" -#include "nsIProtocolProxyService2.h" +#include "nsProtocolProxyService.h" #include "nsIStreamConverterService.h" #include "nsIFile.h" #if defined(XP_MACOSX) @@ -583,32 +583,29 @@ nsresult nsPluginHost::FindProxyForURL(const char* url, char* *result) } nsresult res; - nsCOMPtr uriIn; - nsCOMPtr proxyService; - nsCOMPtr proxyService2; - nsCOMPtr ioService; - - proxyService = do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &res); + nsCOMPtr proxyService = + do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &res); if (NS_FAILED(res) || !proxyService) return res; - proxyService2 = do_QueryInterface(proxyService, &res); - if (NS_FAILED(res) || !proxyService2) - return res; + nsRefPtr rawProxyService = do_QueryObject(proxyService); + if (!rawProxyService) + return NS_ERROR_FAILURE; - ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &res); + nsCOMPtr ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &res); if (NS_FAILED(res) || !ioService) return res; - // make an nsURI from the argument url - res = ioService->NewURI(nsDependentCString(url), nullptr, nullptr, getter_AddRefs(uriIn)); + // make a temporary channel from the argument url + nsCOMPtr tempChannel; + res = ioService->NewChannel(nsDependentCString(url), nullptr, nullptr, getter_AddRefs(tempChannel)); if (NS_FAILED(res)) return res; nsCOMPtr pi; - // Remove this with bug 778201 - res = proxyService2->DeprecatedBlockingResolve(uriIn, 0, getter_AddRefs(pi)); + // Remove this deprecated call in the future (see Bug 778201): + res = rawProxyService->DeprecatedBlockingResolve(tempChannel, 0, getter_AddRefs(pi)); if (NS_FAILED(res)) return res; @@ -1690,6 +1687,35 @@ struct CompareFilesByTime } // anonymous namespace +PRBool nsPluginHost::GhettoBlacklist(nsIFile *pluginFile) +{ + nsCString leaf; + const char *leafStr; + nsresult rv; + + rv = pluginFile->GetNativeLeafName(leaf); + if (NS_FAILED(rv)) { + return PR_TRUE; // fuck 'em. blacklist. + } + + leafStr = leaf.get(); + + if (!leafStr) { + return PR_TRUE; // fuck 'em. blacklist. + } + + // libgnashplugin.so, libflashplayer.so, Flash Player-10.4-10.5.plugin, + // NPSWF32.dll, NPSWF64.dll + if (strstr(leafStr, "libgnashplugin") == leafStr || + strstr(leafStr, "libflashplayer") == leafStr || + strstr(leafStr, "Flash Player") == leafStr || + strstr(leafStr, "NPSWF") == leafStr) { + return PR_FALSE; + } + + return PR_TRUE; // fuck 'em. blacklist. +} + typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void); nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, @@ -1797,6 +1823,10 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, continue; } + if (GhettoBlacklist(localfile)) { + continue; + } + // if it is not found in cache info list or has been changed, create a new one if (!pluginTag) { nsPluginFile pluginFile(localfile); @@ -3075,6 +3105,7 @@ NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject, sInst->Release(); } if (!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic)) { + NS_ConvertUTF16toUTF8 prefName(someData); mPluginsDisabled = Preferences::GetBool("plugin.disable", false); mPluginsClickToPlay = Preferences::GetBool("plugins.click_to_play", false); // Unload or load plugins as needed @@ -3083,6 +3114,16 @@ NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject, } else { LoadPlugins(); } + if (prefName.Equals("plugin.disable")) { + nsCOMPtr obsService = + mozilla::services::GetObserverService(); + if (obsService) { + nsAutoString pluginPolicy; + pluginPolicy = mPluginsDisabled ? NS_LITERAL_STRING("disabled") + : NS_LITERAL_STRING("enabled"); + obsService->NotifyObservers(nullptr, "plugins-policy-changed", pluginPolicy.get()); + } + } } if (!strcmp("blocklist-updated", aTopic)) { nsPluginTag* plugin = mPlugins;