commit 147fb0aa31550c09c0c8498e7e7cedac3e0e84eb Author: Sukhbir Singh sukhbir@torproject.org Date: Fri Jul 10 03:40:43 2015 -0400
Block all plugins from Tor Messenger (closes #16475)
This fix is borrowed from Mike Perry's patch for Tor Browser, but additionally, we also block Flash. --- projects/instantbird/block-plugins.mozpatch | 53 +++++++++++++++++++++++++++ projects/instantbird/config | 1 + 2 files changed, 54 insertions(+)
diff --git a/projects/instantbird/block-plugins.mozpatch b/projects/instantbird/block-plugins.mozpatch new file mode 100644 index 0000000..17813be --- /dev/null +++ b/projects/instantbird/block-plugins.mozpatch @@ -0,0 +1,53 @@ +diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp +--- a/dom/plugins/base/nsPluginHost.cpp ++++ b/dom/plugins/base/nsPluginHost.cpp +@@ -1834,6 +1834,26 @@ + } + } + ++PRBool nsPluginHost::GhettoBlacklist(nsIFile *pluginFile) ++{ ++ nsCString leaf; ++ const char *leafStr; ++ nsresult rv; ++ ++ rv = pluginFile->GetNativeLeafName(leaf); ++ if (NS_FAILED(rv)) { ++ return PR_TRUE; // blacklist. ++ } ++ ++ leafStr = leaf.get(); ++ ++ if (!leafStr) { ++ return PR_TRUE; // blacklist. ++ } ++ ++ return PR_TRUE; // blacklist. ++} ++ + typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void); + + nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, +@@ -1943,6 +1963,10 @@ + 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); +diff --git a/dom/plugins/base/nsPluginHost.h b/dom/plugins/base/nsPluginHost.h +--- a/dom/plugins/base/nsPluginHost.h ++++ b/dom/plugins/base/nsPluginHost.h +@@ -304,6 +304,8 @@ + // Loads all cached plugins info into mCachedPlugins + nsresult ReadPluginInfo(); + ++ PRBool GhettoBlacklist(nsIFile *pluginFile); ++ + // Given a file path, returns the plugins info from our cache + // and removes it from the cache. + void RemoveCachedPluginsInfo(const char *filePath, diff --git a/projects/instantbird/config b/projects/instantbird/config index f33f9c3..ed091f9 100644 --- a/projects/instantbird/config +++ b/projects/instantbird/config @@ -114,6 +114,7 @@ input_files: - filename: f2e7cea9bc6a-bug-1150967.patch enable: '[% c("var/windows") %]' - filename: Bug-9173-Change-the-default-Firefox-profile-director.mozpatch + - filename: block-plugins.mozpatch - filename: 824009fbc42f.mozpatch enable: '[% c("var/windows") %]' - filename: Bug-1133689-backport-Make-D3DVsyncDisplay-destructor.mozpatch
tor-commits@lists.torproject.org