commit 801dde52158fedb0d8b18826045cc8280d0bae6d Author: Mike Perry mikeperry-git@fscked.org Date: Mon Mar 4 19:03:13 2013 -0800
Bug 8313: Verify that plugins are actually enabled before prompting.
Sometimes we seem to get a delayed plugin registration event :/. --- src/chrome/content/torbutton.js | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js index 2b94378..d3c4631 100644 --- a/src/chrome/content/torbutton.js +++ b/src/chrome/content/torbutton.js @@ -126,6 +126,7 @@ var torbutton_unique_pref_observer = if (data == "Gecko-Content-Viewers" && !m_tb_prefs.getBoolPref("extensions.torbutton.startup") && m_tb_prefs.getBoolPref("extensions.torbutton.confirm_plugins")) { + torbutton_log(3, "Got plugin enabled notification: "+subject); torbutton_confirm_plugins(); } return; @@ -498,6 +499,21 @@ function torbutton_prompt_for_language_preference() { }
function torbutton_confirm_plugins() { + var any_plugins_enabled = false; + var PH=Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); + var P=PH.getPluginTags({}); + for(var i=0; i<P.length; i++) { + if (!P[i].disabled) + any_plugins_enabled = true; + } + + if (!any_plugins_enabled) { + torbutton_log(3, "False positive on plugin notification. Ignoring"); + return; + } + + torbutton_log(3, "Confirming plugin usage."); + var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService);
tor-commits@lists.torproject.org