[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10416: Refactored common code between preferences and torbutton int (in torbutton/trunk: . src/chrome/content src/chrome/locale/en-US src/chrome/skin src/defaults/preferences)



Author: mikeperry
Date: 2007-05-31 03:20:44 -0400 (Thu, 31 May 2007)
New Revision: 10416

Added:
   torbutton/trunk/src/chrome/content/jshooks.js
   torbutton/trunk/src/chrome/content/torbutton_util.js
   torbutton/trunk/src/chrome/skin/p.png
   torbutton/trunk/src/chrome/skin/poff.png
   torbutton/trunk/src/chrome/skin/punknown.png
Modified:
   torbutton/trunk/makexpi.sh
   torbutton/trunk/src/chrome/content/preferences.js
   torbutton/trunk/src/chrome/content/preferences.xul
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/chrome/content/torbutton.xul
   torbutton/trunk/src/chrome/content/torbutton_tb.xul
   torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd
   torbutton/trunk/src/chrome/locale/en-US/torbutton.properties
   torbutton/trunk/src/chrome/skin/torbutton.css
   torbutton/trunk/src/defaults/preferences/preferences.js
Log:
Refactored common code between preferences and torbutton into torbutton_util.
Merged in js Date hooking code and plugin toggling. Added (borrowed) icons. 

Code seems to work, but still has various stylistic and other issues that need
to be resolved (grep for XXX).. But right now I'm interested in doing some
experimentation on killing js events.. For that to be easiest, I really need
to have a clean tree to diff against. Bombs away!



Modified: torbutton/trunk/makexpi.sh
===================================================================
--- torbutton/trunk/makexpi.sh	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/makexpi.sh	2007-05-31 07:20:44 UTC (rev 10416)
@@ -5,7 +5,8 @@
 
 if [ -e "pkg/$XPI_NAME" ]; then
   echo pkg/$XPI_NAME already exists.
-  exit 1
+  rm pkg/$XPI_NAME # meh.
+  #  exit 1
 fi
 
 # create jar file (we're just storing files here)
@@ -18,11 +19,12 @@
 echo ---------- create $APP_NAME.xpi ----------
 cd src
 echo zip -9r ../pkg/$XPI_NAME ./ -x "chrome/*" -x "*.svn/*"
-zip -9r ../pkg/$XPI_NAME ./ -x "chrome/*" -x "*.svn/*"
+zip -9r ../pkg/$XPI_NAME ./ -x "*.svn/*" -x "chrome/*"
 mv ../$APP_NAME.jar ./chrome
 zip -9m ../pkg/$XPI_NAME chrome/$APP_NAME.jar
 cd ..
 
+#cp ./pkg/$XPI_NAME ~/
 #zip -9m ../../downloads/$sXpiName  chrome/$APP_NAME.jar
 #zip -9  ../../downloads/$sXpiName  install.rdf
 #cd ..

Added: torbutton/trunk/src/chrome/content/jshooks.js
===================================================================
--- torbutton/trunk/src/chrome/content/jshooks.js	                        (rev 0)
+++ torbutton/trunk/src/chrome/content/jshooks.js	2007-05-31 07:20:44 UTC (rev 10416)
@@ -0,0 +1,205 @@
+dump("Loading torbutton/jshooks.js\n");
+
+function __HookObjects() {
+  // TODO: It might be a good idea to hook window sizes also..
+  // But that will almost certainly fuck with rendering
+
+  // XXX: Is it possible this breaks plugin install or other weird shit
+  // for non-windows OS's?
+  navigator.__defineGetter__("platform", 
+        function() { return "Windows";});
+  
+  navigator.__defineGetter__("oscpu", 
+        function() { return "Win32 i686";});
+
+  // CSS hack fix for http://gemal.dk/browserspy/css.html
+  // Must be a var, not a function (to avoid hooking via prototype)
+  /*
+  var removeAllAttributes = function(e) {
+    var atts = e.attributes;
+    if(e.nodeName.toLowerCase() == "a") {
+      for(var i = atts.length; i != 0; --i) {
+        if(atts[0].name.toLowerCase() != "href") {
+          e.removeAttribute(atts[0].name);
+        } else if(atts.length > 1){
+          e.removeAttribute(atts[1].name);
+        }
+      }
+      if(e.attributes.length>1) dump("FUCK\n");
+    }
+  }
+
+  var gEID = document.getElementById;
+  document.getElementById = function(id) {
+    var ret = gEID.call(document, id);
+    if (ret) removeAllAttributes(ret);
+    return ret;
+  }
+
+  var gEN = document.getElementsByName;
+  document.getElementsByName = function(name) {
+    var ret = gEN.call(document, name);
+    for(var i=0; i < ret.length; ++i)  removeAllAttributes(ret[i]); 
+    return ret;
+  }
+
+  var gENS = document.getElementsByNameNS;
+  document.getElementsByNameNS = function(name,ns) {
+    var ret = gENS.call(document, name,ns);
+    for(var i=0; i < ret.length; ++i)  removeAllAttributes(ret[i]); 
+    return ret;
+  }
+
+  var gETN = document.getElementsByTagName;
+  document.getElementsByTagName = function(name) {
+    var ret = gETN.call(document, name);
+    for(var i=0; i < ret.length; ++i) removeAllAttributes(ret[i]);
+    return ret;
+  }
+
+  var gETNS = document.getElementsByTagNameNS;
+  document.getElementsByTagNameNS = function(name,ns) {
+    var ret = gETNS.call(document, name, ns);
+    for(var i=0; i < ret.length; ++i)  removeAllAttributes(ret[i]);
+    return ret;
+  }
+  */
+  
+
+  // Timezone fix for http://gemal.dk/browserspy/css.html
+  var reparseDate = function(d, str) {
+    // Rules:
+    //   - If they specify a timezone, it is converted to local
+    //     time. All getter fucntions then convert properly to
+    //     UTC. No mod needed.
+    //   - If they specify UTC timezone, then it is converted
+    //     to local time. All getter functions then convert back.
+    //     No mod needed.
+    //   - If they specify NO timezone, it is local time. 
+    //     The UTC conversion then reveals the offset. Fix.
+    
+    // Step 1: Remove everything inside ()'s (they are "comments")
+    var s = str.toLowerCase();
+    var re = new RegExp('\\(.*\\)', "gm");
+    s = s.replace(re, "");
+    dump(s);
+    // Step 2: Look for +/-. If found, do nothing
+    if(s.indexOf("+") == -1 && s.indexOf("-") == -1) {
+      // Step 3: Look for timezone string from
+      // http://lxr.mozilla.org/seamonkey/source/js/src/jsdate.c 
+      if(s.indexOf(" gmt") == -1 && s.indexOf(" ut") == -1 &&
+         s.indexOf(" est") == -1 && s.indexOf(" edt") == -1 &&
+         s.indexOf(" cst") == -1 && s.indexOf(" cdt") == -1 &&
+         s.indexOf(" mst") == -1 && s.indexOf(" mdt") == -1 &&
+         s.indexOf(" pst") == -1 && s.indexOf(" pdt")) {
+        // No timezone specified. Adjust.
+        d.setTime(d.getTime()-(d.getTimezoneOffset()*60000));
+      }
+    } 
+  } 
+
+  var tmp = Date;
+  Date = function() {
+    // DO NOT make 'd' a member! EvilCode will use it!
+    var d;
+    var a = arguments;
+    // apply doesn't seem to work for constructors :(
+    if(arguments.length == 0) d=new tmp();
+    if(arguments.length == 1) d=new tmp(a[0]);
+    if(arguments.length == 3) d=new tmp(a[0],a[1],a[2]);
+    if(arguments.length == 4) d=new tmp(a[0],a[1],a[2],a[3]);
+    if(arguments.length == 5) d=new tmp(a[0],a[1],a[2],a[3],a[4]);
+    if(arguments.length == 6) d=new tmp(a[0],a[1],a[2],a[3],a[4],a[5]);
+    if(arguments.length == 7) d=new tmp(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);
+    if(arguments.length > 7) d=new tmp();
+
+    if(arguments.length > 0) {
+      if((arguments.length == 1) && typeof(a[0]) == "string") {
+        reparseDate(d,a[0]);
+      } else if(arguments.length > 1) { 
+        // Numerical value. No timezone given, adjust.
+        d.setTime(d.getTime()-(d.getTimezoneOffset()*60000));
+      }
+    }
+
+    Date.prototype.valueOf=Date.prototype.getTime = // UTC already
+         function(){return d.getTime();}
+    Date.prototype.getFullYear=function(){return d.getUTCFullYear();}  
+    Date.prototype.getYear=function() {return d.getUTCYear();}
+    Date.prototype.getMonth=function(){return d.getUTCMonth();}
+    Date.prototype.getDate=function() {return d.getUTCDate();}
+    Date.prototype.getDay=function() {return d.getUTCDay();}
+    Date.prototype.getHours=function(){return d.getUTCHours();}
+    Date.prototype.getMinutes=function(){return d.getUTCMinutes();}
+    Date.prototype.getSeconds=function(){return d.getUTCSeconds();}
+    Date.prototype.getMilliseconds=function(){return d.getUTCMilliseconds();}
+    Date.prototype.getTimezoneOffset=function(){return 0;}
+ 
+    Date.prototype.setTime = 
+       function(x) {return d.setTime(x);}
+    Date.prototype.setFullYear=function(x){return d.setUTCFullYear(x);}
+    Date.prototype.setYear=function(x){return d.setUTCYear(x);}
+    Date.prototype.setMonth=function(x){return d.setUTCMonth(x);}
+    Date.prototype.setDate=function(x){return d.setUTCDate(x);}
+    Date.prototype.setDay=function(x){return d.setUTCDay(x);}
+    Date.prototype.setHours=function(x){return d.setUTCHours(x);}
+    Date.prototype.setMinutes=function(x){return d.setUTCMinutes(x);}
+    Date.prototype.setSeconds=function(x){return d.setUTCSeconds(x);}
+    Date.prototype.setMilliseconds=
+       function(x) {return d.setUTCMilliseconds(x);}
+ 
+    Date.prototype.getUTCFullYear=function(){return d.getUTCFullYear();}  
+    Date.prototype.getUTCYear=function() {return d.getUTCYear();}
+    Date.prototype.getUTCMonth=function(){return d.getUTCMonth();}
+    Date.prototype.getUTCDate=function() {return d.getUTCDate();}
+    Date.prototype.getUTCDay=function() {return d.getUTCDay();}
+    Date.prototype.getUTCHours=function(){return d.getUTCHours();}
+    Date.prototype.getUTCMinutes=function(){return d.getUTCMinutes();}
+    Date.prototype.getUTCSeconds=function(){return d.getUTCSeconds();}
+    Date.prototype.getUTCMilliseconds=
+       function(){return d.getUTCMilliseconds();}
+     
+    Date.prototype.setUTCFullYear=function(x){return d.setUTCFullYear(x);}
+    Date.prototype.setUTCYear=function(x){return d.setUTCYear(x);}
+    Date.prototype.setUTCMonth=function(x){return d.setUTCMonth(x);}
+    Date.prototype.setUTCDate=function(x){return d.setUTCDate(x);}
+    Date.prototype.setUTCDay=function(x){return d.setUTCDay(x);}
+    Date.prototype.setUTCHours=function(x){return d.setUTCHours(x);}
+    Date.prototype.setUTCMinutes=function(x){return d.setUTCMinutes(x);}
+    Date.prototype.setUTCSeconds=function(x){return d.setUTCSeconds(x);}
+    Date.prototype.setUTCMilliseconds=
+        function(x) {return d.setUTCMilliseconds(x);}
+  
+    Date.prototype.toUTCString=function(){return d.toUTCString();}
+    Date.prototype.toGMTString=function(){return d.toGMTString();}
+    Date.prototype.toString=function(){return d.toUTCString();}
+    Date.prototype.toLocaleString=function(){return d.toUTCString();}
+    
+    // XXX: Fuck 'em if they can't take a joke:
+    Date.prototype.toLocaleTimeString=function(){return d.toUTCString();}
+    Date.prototype.toLocaleDateString=function(){return d.toUTCString();}
+    Date.prototype.toDateString=function(){return d.toUTCString();}
+    Date.prototype.toTimeString=function(){return d.toUTCString();}
+
+     // Hack to solve the problem of multiple date objects
+    // all sharing the same lexically scoped d every time a new one is
+    // created. This hack creates a fresh new prototype reference for 
+    // the next object to use with a different d binding.
+    Date.prototype = new Object.prototype.toSource();
+    return d.toUTCString();
+  }
+
+  Date.parse=function(s) {
+    var d = new tmp(s);
+    if(typeof(s) == "string") reparseDate(d, s);
+    return d.getTime();    
+  }
+
+  Date.now=function(){return tmp.now();}
+  Date.UTC=function(){return tmp.apply(tmp, arguments); }
+}
+
+if (typeof(window.__tb_hooks_ran) == 'undefined') {
+    window.__tb_hooks_ran = true;
+    __HookObjects();
+}

Modified: torbutton/trunk/src/chrome/content/preferences.js
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.js	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/content/preferences.js	2007-05-31 07:20:44 UTC (rev 10416)
@@ -19,6 +19,8 @@
     {
       doc.getElementById('torbutton_usePrivoxy').setAttribute("disabled", true);
     } else {
+	  // XXX: This seems broken.. The first time the prefs window is open it 
+      // is still editable.
       doc.getElementById('torbutton_usePrivoxy').setAttribute("disabled", doc.getElementById('torbutton_settingsMethod').value != 'recommended');
     }
     var proxy_port;
@@ -33,6 +35,7 @@
         proxy_host = '';
         proxy_port = 0;
     }
+
     if (doc.getElementById('torbutton_settingsMethod').value == 'recommended') {
         torbutton_log(5, "using recommended settings");
         if (!torbutton_check_socks_remote_dns())
@@ -133,6 +136,11 @@
     doc.getElementById('torbutton_socksPort').value    = o_torprefs.getIntPref('socks_port');
     // doc.getElementById('torbutton_warnUponExcludedSite').checked = o_torprefs.getBoolPref('prompt_before_visiting_excluded_sites');
 
+	// XXX: work this in with recommended settigns stuff?
+    doc.getElementById('torbutton_disablePlugins').checked = o_torprefs.getBoolPref('no_tor_plugins');
+    doc.getElementById('torbutton_clearHistory').checked = o_torprefs.getBoolPref('clear_history');
+    doc.getElementById('torbutton_clearCookies').checked = o_torprefs.getBoolPref('clear_cookies'); 
+    doc.getElementById('torbutton_killBadJS').checked = o_torprefs.getBoolPref('kill_bad_js');
     torbutton_prefs_set_field_attributes(doc);
 }
 
@@ -171,6 +179,12 @@
     }
     // o_torprefs.setBoolPref('prompt_before_visiting_excluded_sites', doc.getElementById('torbutton_warnUponExcludedSite').checked);
 
+	// XXX: work this in with recommended settigns stuff?
+    o_torprefs.setBoolPref('no_tor_plugins', doc.getElementById('torbutton_disablePlugins').checked);
+    o_torprefs.setBoolPref('clear_history', doc.getElementById('torbutton_clearHistory').checked);
+    o_torprefs.setBoolPref('clear_cookies', doc.getElementById('torbutton_clearCookies').checked);
+    o_torprefs.setBoolPref('kill_bad_js', doc.getElementById('torbutton_killBadJS').checked);
+
     // if tor settings were initially active, update the active settings to reflect any changes
     if (tor_enabled) torbutton_activate_tor_settings();
 }

Modified: torbutton/trunk/src/chrome/content/preferences.xul
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.xul	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/content/preferences.xul	2007-05-31 07:20:44 UTC (rev 10416)
@@ -12,7 +12,7 @@
         onload="torbutton_prefs_init(document)"
         ondialogaccept="torbutton_prefs_save(document)" >
 
-    <script type="application/x-javascript" src="torbutton.js"/>
+    <script type="application/x-javascript" src="torbutton_util.js"/>
     <script type="application/x-javascript" src="preferences.js"/>
     <groupbox>
         <caption label="&torbutton.prefs.display_settings;"/>
@@ -110,6 +110,19 @@
         <textbox id="socks_port"/>
 -->
     </groupbox>
+    <groupbox>
+        <caption label="&torbutton.prefs.sec_settings;"/>
+        <checkbox id="torbutton_disablePlugins" label="&torbutton.prefs.disable_plugins;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+        <checkbox id="torbutton_killBadJS" label="&torbutton.prefs.kill_bad_js;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+        <checkbox id="torbutton_clearCookies" label="&torbutton.prefs.clear_cookies;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+        <checkbox id="torbutton_clearHistory" label="&torbutton.prefs.clear_history;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+    </groupbox>
+
+
 <!--
     <checkbox id="torbutton_warnUponExcludedSite" label="&torbutton.prefs.prompt_before_visiting_excluded_sites;" />
     <description>

Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2007-05-31 07:20:44 UTC (rev 10416)
@@ -1,5 +1,7 @@
 // status
 var m_wasinited = false;
+var m_prefs = false; // FIXME: make into singleton with rest of cached globals?
+var m_jshooks = false;
 
 var torbutton_pref_observer =
 {
@@ -57,6 +59,9 @@
             case "network.proxy.type":
                 torbutton_set_status();
                 break;
+            case "extensions.torbutton.allow_plugins":
+                torbutton_set_plugin_status();
+                break;
         }
     }
 }
@@ -132,23 +137,7 @@
     return o_stringbundle;
 }
 
-// check if the socks_remote_dns preference exists
-function torbutton_check_socks_remote_dns()
-{
-    var o_prefbranch = false;
 
-    o_prefbranch = torbutton_get_prefbranch("network.proxy.");
-    // check if this version of Firefox has the socks_remote_dns option
-    try {
-        o_prefbranch.getBoolPref('socks_remote_dns');
-        torbutton_log(3, "socks_remote_dns is available");
-        return true;
-    } catch (rErr) {
-        // no such preference
-        torbutton_log(3, "socks_remote_dns is unavailable");
-        return false;
-    }
-}
 
 function torbutton_init_toolbutton(event)
 {
@@ -172,6 +161,12 @@
     }
 
     if (!m_wasinited) {
+        m_prefs =  Components.classes["@mozilla.org/preferences-service;1"]
+                        .getService(Components.interfaces.nsIPrefService);
+
+        torbutton_init_pluginbutton();
+        torbutton_init_jshooks();
+
         torbutton_log(5, 'registering pref observer');
         torbutton_pref_observer.register();
         m_wasinited = true;
@@ -182,34 +177,13 @@
     torbutton_set_panel_view();
     torbutton_log(2, 'setting torbutton status from proxy prefs');
     torbutton_set_status();
+    torbutton_set_plugin_status();
     torbutton_log(2, 'init completed');
 }
 
-// get a preferences branch object
-function torbutton_get_prefbranch(branch_name) {
-    var o_prefs = false;
-    var o_branch = false;
-
-    torbutton_log(4, "called get_prefbranch()");
-    o_prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                        .getService(Components.interfaces.nsIPrefService);
-    if (!o_prefs)
-    {
-        torbutton_log(3, "failed to get preferences-service");
-        return false;
-    }
-    o_branch = o_prefs.getBranch(branch_name);
-    if (!o_branch)
-    {
-        torbutton_log(3, "failed to get prefs branch");
-        return false;
-    }
-
-    return o_branch;
-}
-
 // this function duplicates a lot of code in preferences.js for deciding our
 // recommended settings.  figure out a way to eliminate the redundancy.
+// FIXME: Move it to torbutton_util.js
 function torbutton_init_prefs() {
     var torprefs = false;
     var proxy_port;
@@ -258,6 +232,7 @@
         torprefs.setCharPref('socks_host', 'localhost');
         torprefs.setIntPref('socks_port', 9050);
     }
+
     torbutton_log(1, 'http_port='+torprefs.getIntPref('http_port'));
     // m_prefs.setCharPref('extensions.torbutton.http_proxy',   m_http_proxy);
     // m_prefs.setIntPref('extensions.torbutton.http_port',     m_http_port);
@@ -301,35 +276,6 @@
     return o_statuspanel;
 }
 
-function torbutton_check_status() {
-    var liveprefs = false;
-    var torprefs = false;
-
-    liveprefs = torbutton_get_prefbranch('network.proxy.');
-    torprefs = torbutton_get_prefbranch('extensions.torbutton.');
-    if (!liveprefs || !torprefs) return;
-
-    if (torbutton_check_socks_remote_dns())
-         remote_dns = liveprefs.getBoolPref("socks_remote_dns");
-    else
-         remote_dns = true;
-
-    return ( (liveprefs.getIntPref("type")           == 1)              &&
-             (liveprefs.getCharPref("http")          == torprefs.getCharPref('http_proxy'))   &&
-             (liveprefs.getIntPref("http_port")      == torprefs.getIntPref('http_port'))     &&
-             (liveprefs.getCharPref("ssl")           == torprefs.getCharPref('https_proxy'))  &&
-             (liveprefs.getIntPref("ssl_port")       == torprefs.getIntPref('https_port'))    &&
-             (liveprefs.getCharPref("ftp")           == torprefs.getCharPref('ftp_proxy'))    &&
-             (liveprefs.getIntPref("ftp_port")       == torprefs.getIntPref('ftp_port'))      &&
-             (liveprefs.getCharPref("gopher")        == torprefs.getCharPref('gopher_proxy')) &&
-             (liveprefs.getIntPref("gopher_port")    == torprefs.getIntPref('gopher_port'))   &&
-             (liveprefs.getCharPref("socks")         == torprefs.getCharPref('socks_host'))   &&
-             (liveprefs.getIntPref("socks_port")     == torprefs.getIntPref('socks_port'))    &&
-             (liveprefs.getIntPref("socks_version")  == 5)              &&
-             (liveprefs.getBoolPref("share_proxy_settings") == false)   &&
-             (remote_dns == true) );
-}
-
 function torbutton_save_nontor_settings()
 {
   var liveprefs = false;
@@ -384,33 +330,13 @@
   } catch(e) {}
   if (torbutton_check_socks_remote_dns())
     liveprefs.setBoolPref('socks_remote_dns',     savprefs.getBoolPref('socks_remote_dns'));
-}
+    
+  // XXX: hrmm..
+  var torprefs = torbutton_get_prefbranch('extensions.torbutton.');
 
-function torbutton_activate_tor_settings()
-{
-  var liveprefs = false;
-  var torprefs = false;
-
-  liveprefs = torbutton_get_prefbranch('network.proxy.');
-  torprefs = torbutton_get_prefbranch('extensions.torbutton.');
-  if (!liveprefs || !torprefs) return;
-
-  liveprefs.setCharPref('http',         torprefs.getCharPref('http_proxy'));
-  liveprefs.setIntPref('http_port',     torprefs.getIntPref('http_port'));
-  liveprefs.setCharPref('ssl',          torprefs.getCharPref('https_proxy'));
-  liveprefs.setIntPref('ssl_port',      torprefs.getIntPref('https_port'));
-  liveprefs.setCharPref('ftp',          torprefs.getCharPref('ftp_proxy'));
-  liveprefs.setIntPref('ftp_port',      torprefs.getIntPref('ftp_port'));
-  liveprefs.setCharPref('gopher',       torprefs.getCharPref('gopher_proxy'));
-  liveprefs.setIntPref('gopher_port',   torprefs.getIntPref('gopher_port'));
-  liveprefs.setCharPref('socks',        torprefs.getCharPref('socks_host'));
-  liveprefs.setIntPref('socks_port',    torprefs.getIntPref('socks_port'));
-  liveprefs.setIntPref('socks_version', 5);
-  liveprefs.setBoolPref('share_proxy_settings', false);
-  if (torbutton_check_socks_remote_dns()) {
-      liveprefs.setBoolPref('socks_remote_dns', true);
+  if(torprefs.getBoolPref("no_tor_plugins")) {
+    torprefs.setBoolPref("allow_plugins", true);
   }
-  liveprefs.setIntPref('type', 1);
 }
 
 function torbutton_disable_tor()
@@ -431,10 +357,10 @@
 {
   o_toolbutton = torbutton_get_toolbutton();
   if (!o_toolbutton) return;
+  // XXX: This is a global... elsewhere too
   o_stringbundle = torbutton_get_stringbundle();
 
-  if (mode)
-  {
+  if (mode) {
       tooltip = o_stringbundle.GetStringFromName("torbutton.button.tooltip.enabled");
       o_toolbutton.setAttribute('tbstatus', 'on');
       o_toolbutton.setAttribute('tooltiptext', tooltip);
@@ -479,6 +405,15 @@
     torbutton_log(2, 'called update_status('+mode+')');
     torbutton_update_toolbutton(mode);
     torbutton_update_statusbar(mode);
+
+    // XXX: hrmm..
+    var torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+    if (torprefs.getBoolPref('clear_history')) {
+        ClearHistory();
+    }
+    if (torprefs.getBoolPref('clear_cookies')) {
+        ClearCookies();
+    }
 }
 
 function torbutton_open_prefs_dialog() {
@@ -574,37 +509,257 @@
   // window.sizeToContent();
 }
 
-function torbutton_log(nLevel, sMsg) {
-    var o_log_mgr    = false;
-    var o_tb_logger  = false;
-    var o_prefs      = false;
-    var o_prefbranch = false;
-    var m_debug      = false;
+// -------------- HISTORY & COOKIES ---------------------
 
-    o_prefbranch = Components.classes["@mozilla.org/preferences-service;1"]
-                             .getService(Components.interfaces.nsIPrefService)
-                             .getBranch('extensions.torbutton.');
+function SaveHistory() {
+    // FIXME: This is documented, but not implemented :(
+    torbutton_log(2, 'called SaveHistory');
+    var saver = Components.classes["@mozilla.org/browser/global-history;2"]
+                    .getService(Components.interfaces.nsIRDFRemoteDataSource);
+    saver.FlushTo("TorButton_prehistory.rdf");
+}
 
-    if (!o_prefbranch)
-        return false;
-    m_debug = o_prefbranch.getBoolPref('debug');
+function LoadHistory() {
+    // FIXME: This is documented, but not implemented :(
+    torbutton_log(2, 'called LoadHistory');
+    var loader = Components.classes["@mozilla.org/browser/global-history;2"]
+                    .getService(Components.interfaces.nsIRDFRemoteDataSource);
+    loader.Init("TorButton_prehistory.rdf");
+    loader.Refresh(true);
+}
 
-    if (m_debug)
-    {
-        try {
-            o_log_mgr   = Components.classes["@mozmonkey.com/debuglogger/manager;1"]
-                                    .getService(Components.interfaces.nsIDebugLoggerManager); 
-            o_tb_logger = o_log_mgr.registerLogger("torbutton");
-        } catch (exErr) {
-            o_tb_logger = false;
-        }
+function ClearHistory() {
+    torbutton_log(2, 'called ClearHistory');
+    var hist = Components.classes["@mozilla.org/browser/global-history;2"]
+                    .getService(Components.interfaces.nsIBrowserHistory);
+    hist.removeAllPages();    
+}
 
-        var rDate = new Date();
-        if (o_tb_logger) {
-            o_tb_logger.log(nLevel, rDate.getTime()+': '+sMsg);
-        } else {
-            dump("ERROR: o_tb_logger undefined ");
-            dump(rDate.getTime()+': '+sMsg+"\n");
+function ClearCookies() {
+    torbutton_log(2, 'called ClearCookies');
+    var cm = Components.classes["@mozilla.org/cookiemanager;1"]
+                    .getService(Components.interfaces.nsICookieManager);
+    cm.removeAll();
+}
+
+
+// -------------- PLUGIN HANDLING CODE ---------------------
+
+function AllowWindowPlugins(win, onOff) {
+    torbutton_log(1, "AllowWindowPlugs "+onOff);
+    var browser = win.getBrowser();
+   
+    browser.docShell.allowPlugins = onOff;
+    var browsers = browser.browsers;
+
+    for (var i = 0; i < browsers.length; ++i) {
+        var b = browser.getBrowserAtIndex(i);
+        if (b) {
+            torbutton_log(1, " plugins1: " + b.docShell.allowPlugins);
+            b.docShell.allowPlugins = onOff;
+            torbutton_log(1, " plugins2: " + b.docShell.allowPlugins);
         }
     }
 }
+
+function AllowPlugins(onOff) {
+    torbutton_log(1, "Plugins: "+onOff);
+    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                       .getService(Components.interfaces.nsIWindowMediator);
+    // XXX: Popupwindows? frames/iframes? Hidden iframes? bookmarklets?
+    var enumerator = wm.getEnumerator("navigator:browser");
+    torbutton_log(1, "Plugins0: ");
+    while(enumerator.hasMoreElements()) {
+        var win = enumerator.getNext();
+        torbutton_log(1, "Plugins1");
+        AllowWindowPlugins(win, onOff);   
+    }
+}
+
+function torbutton_init_pluginbutton() {
+    if(m_prefs.getBoolPref("extensions.torbutton.no_tor_plugins") 
+        && torbutton_check_status()) {
+        m_prefs.setBoolPref("extensions.torbutton.allow_plugins", false)
+    }
+}
+
+function torbutton_toggle_plugins() {
+    torbutton_log(1, 'called toggle_plugins()');
+    if (!m_wasinited) {
+        torbutton_init();
+    }
+
+    var tb = m_prefs.getBoolPref("extensions.torbutton.allow_plugins");
+    m_prefs.setBoolPref("extensions.torbutton.allow_plugins", !tb);
+}
+
+function torbutton_set_plugin_status() {
+    if (!m_wasinited) {
+        torbutton_init();
+    }
+
+    if (m_prefs.getBoolPref("extensions.torbutton.allow_plugins")) {
+        torbutton_log(1,'plugins are enabled');
+        torbutton_update_plugin_status(1);
+    } else {
+        torbutton_log(1,'plugins are disabled');
+        torbutton_update_plugin_status(0);
+    }
+}
+
+function torbutton_update_plugin_status(nMode) {
+    torbutton_log(2, 'called update_plugin_status('+nMode+')');
+    if (!window.statusbar.visible)
+        return;
+    torbutton_log(2, 'visible statusbar: ('+nMode+')');
+    var o_stringbundle = torbutton_get_stringbundle();
+
+    var tooltip;    
+
+    if(nMode) {
+        tooltip = o_stringbundle.GetStringFromName("torbutton.panel.plugins.enabled");
+    } else {
+        tooltip = o_stringbundle.GetStringFromName("torbutton.panel.plugins.disabled");
+    }
+  
+    // FIXME: hrmm.. consider changing this value
+    document.getElementById("plugins-status").setAttribute("status", nMode ?  "1" : "0");
+    document.getElementById("plugins-status").setAttribute('tooltiptext', tooltip);
+
+    m_prefs.setBoolPref("security.enable_java", nMode);
+    AllowPlugins(nMode);
+    
+    torbutton_log(2, 'javascript toggled');
+}
+
+// ---------------------- Event handlers -----------------
+
+function NewTabEvent(event)
+{ 
+    // listening for new tabs
+    torbutton_log(1, "New tab");
+
+    // Fucking garbage.. event is delivered to the current tab, not the 
+    // newly created one. Need to traverse the current window for it.
+    if(!m_prefs.getBoolPref("extensions.torbutton.allow_plugins")) {
+        var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                   .getService(Components.interfaces.nsIWindowMediator);
+        var browserWindow = wm.getMostRecentWindow("navigator:browser");  
+        AllowWindowPlugins(browserWindow, false);
+    }
+}
+
+function NewWindowEvent(event)
+{
+    if (!m_wasinited) {
+        torbutton_init();
+    }
+    torbutton_log(1, "New window");
+
+    if(!m_prefs.getBoolPref("extensions.torbutton.allow_plugins")) {
+        getBrowser().docShell.allowPlugins = false;
+    }
+
+    getBrowser().addProgressListener(myListener,
+      Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT|
+      Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
+}
+
+window.addEventListener('load',NewWindowEvent,false);
+getBrowser().addEventListener("TabOpen", NewTabEvent, false);
+
+
+// ----------- JAVASCRIPT HOOKING + EVENT HANDLERS ----------------
+
+function torbutton_init_jshooks() {
+    torbutton_log(1, "torbutton_init_jshooks()");
+    var nsio = Components.classes["@mozilla.org/network/io-service;1"]
+                .getService(Components.interfaces.nsIIOService);
+    var chan = nsio.newChannel("chrome://torbutton/content/jshooks.js", 
+                               null, null);
+    var istream = Components.classes["@mozilla.org/scriptableinputstream;1"].
+            createInstance(Components.interfaces.nsIScriptableInputStream);
+
+    istream.init(chan.open());
+    m_jshooks = istream.read(istream.available());
+    istream.close();
+}
+
+function getBody(doc) {
+    if (doc.body)
+        return doc.body;
+    else if (doc.documentElement)
+        return doc.documentElement;
+    return null;
+}
+
+function hookDoc(win, doc) {
+    torbutton_log(1, "Hooking document");
+    if (!m_wasinited) {
+        torbutton_init();
+    }
+    if(!m_prefs.getBoolPref('extensions.torbutton.kill_bad_js'))
+        return;
+    if(typeof(win.__tb_did_hook) != 'undefined')
+        return; // Ran already
+
+    win.__tb_did_hook = true;
+    var str = "<"+"script>";
+    str += m_jshooks; // XXX: dne
+//    str +="alert(\"hi\");";
+    str += "</"+"script>";
+    var d = doc.createElement("div");
+    d.style.visibility = 'hidden';
+    d.innerHTML = str;
+    getBody(doc).insertBefore(d, getBody(doc).firstChild);
+}
+
+const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
+const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;
+var myListener =
+{
+  QueryInterface: function(aIID)
+  {
+   if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
+       aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
+       aIID.equals(Components.interfaces.nsISupports))
+     return this;
+   throw Components.results.NS_NOINTERFACE;
+  },
+
+  onStateChange: function(aProgress, aRequest, aFlag, aStatus)
+  { torbutton_log(1, 'State change()'); return 0; },
+
+  onLocationChange: function(aProgress, aRequest, aURI)
+  {
+    torbutton_log(1, 'onLocationChange');
+   // This fires when the location bar changes i.e load event is confirmed
+   // or when the user switches tabs
+    if(aProgress) {
+        torbutton_log(1, "location progress");
+        // XXX: Check mimetype or DOM to not fuck with .txt files and other
+        // formats..
+        var doc = aProgress.DOMWindow.document;
+        if(doc) hookDoc(aProgress.DOMWindow, doc);        
+        else torbutton_log(3, "No DOM at location event!");
+    } else {
+        torbutton_log(3, "No aProgress for location!");
+    }
+    return 0;
+  },
+
+  onProgressChange: function(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) 
+  { torbutton_log(1, 'called progressChange'); return 0; },
+  
+  onStatusChange: function() 
+  { torbutton_log(1, 'called statusChange'); return 0; },
+  
+  onSecurityChange: function() {return 0;},
+  
+  onLinkIconAvailable: function() 
+  { torbutton_log(1, 'called linkIcon'); return 0; }
+}
+
+
+
+//vim:set ts=4

Modified: torbutton/trunk/src/chrome/content/torbutton.xul
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.xul	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/content/torbutton.xul	2007-05-31 07:20:44 UTC (rev 10416)
@@ -6,6 +6,7 @@
 
 <overlay id="torbutton-overlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";>
+    <script type="application/x-javascript" src="chrome://torbutton/content/torbutton_util.js" />
     <script type="application/x-javascript" src="chrome://torbutton/content/torbutton.js" />
     <script language="JavaScript">
         //onLoad Hander
@@ -36,11 +37,12 @@
     </keyset>
 
     <statusbar id="status-bar">
-        <statusbarpanel	id="torbutton-panel"
-			insertbefore="statusbar-updates"
+        <statusbarpanel id="torbutton-panel"
+            insertbefore="statusbar-updates"
                         context="torbutton-context-menu"
-			onclick="if (event.button == 0) torbutton_toggle()"/>
+            onclick="if (event.button == 0) torbutton_toggle()"/>
 
         <popup id="torbutton-context-menu"/>
+        <statusbarpanel context="clipmenu" class="statusbarpanel-iconic" id="plugins-status" tooltip="plugin-tooltip" onclick="torbutton_toggle_plugins();"/>
    </statusbar>
 </overlay>

Modified: torbutton/trunk/src/chrome/content/torbutton_tb.xul
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton_tb.xul	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/content/torbutton_tb.xul	2007-05-31 07:20:44 UTC (rev 10416)
@@ -46,10 +46,10 @@
     </keyset>
 
     <statusbar id="status-bar">
-        <statusbarpanel	id="torbutton-panel"
-			insertbefore="statusbar-updates"
+        <statusbarpanel id="torbutton-panel"
+            insertbefore="statusbar-updates"
                         context="torbutton-context-menu"
-			onclick="if (event.button == 0) torbutton_toggle()"/>
+            onclick="if (event.button == 0) torbutton_toggle()"/>
 
         <popup id="torbutton-context-menu"/>
    </statusbar>

Added: torbutton/trunk/src/chrome/content/torbutton_util.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton_util.js	                        (rev 0)
+++ torbutton/trunk/src/chrome/content/torbutton_util.js	2007-05-31 07:20:44 UTC (rev 10416)
@@ -0,0 +1,131 @@
+var m_tb_logger = false;
+var m_tb_console = false;
+var m_debug = true; // XXX: use pref
+var m_loglevel = 1;
+
+try {
+    var logMngr = Components.classes["@mozmonkey.com/debuglogger/manager;1"]
+                    .getService(Components.interfaces.nsIDebugLoggerManager); 
+    m_tb_logger = logMngr.registerLogger("torbutton");
+} catch (exErr) {
+    m_tb_console = Components.classes["@mozilla.org/consoleservice;1"]
+                    .getService(Components.interfaces.nsIConsoleService);
+    m_tb_logger = false;
+}
+
+function torbutton_log(nLevel, sMsg) {
+    var rDate = new Date();
+    if (m_tb_logger) {
+        m_tb_logger.log(nLevel, rDate.getTime()+': '+sMsg);
+    } else if (m_debug && m_tb_console && nLevel >= m_loglevel) {
+        m_tb_console.logStringMessage(rDate.getTime()+': '+sMsg);
+    } else if (m_debug && nLevel >= m_loglevel) {
+        dump(rDate.getTime()+': '+sMsg+"\n");
+    }
+}
+
+// get a preferences branch object
+function torbutton_get_prefbranch(branch_name) {
+    var o_prefs = false;
+    var o_branch = false;
+
+    torbutton_log(4, "called get_prefbranch()");
+    o_prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                        .getService(Components.interfaces.nsIPrefService);
+    if (!o_prefs)
+    {
+        torbutton_log(3, "failed to get preferences-service");
+        return false;
+    }
+
+    o_branch = o_prefs.getBranch(branch_name);
+    if (!o_branch)
+    {
+        torbutton_log(3, "failed to get prefs branch");
+        return false;
+    }
+
+    return o_branch;
+}
+
+// check if the socks_remote_dns preference exists
+function torbutton_check_socks_remote_dns()
+{
+    var o_prefbranch = false;
+
+    o_prefbranch = torbutton_get_prefbranch("network.proxy.");
+    // check if this version of Firefox has the socks_remote_dns option
+    try {
+        o_prefbranch.getBoolPref('socks_remote_dns');
+        torbutton_log(3, "socks_remote_dns is available");
+        return true;
+    } catch (rErr) {
+        // no such preference
+        torbutton_log(3, "socks_remote_dns is unavailable");
+        return false;
+    }
+}
+
+function torbutton_check_status() {
+    var liveprefs = false;
+    var torprefs = false;
+
+    liveprefs = torbutton_get_prefbranch('network.proxy.');
+    torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+    if (!liveprefs || !torprefs) return;
+
+    if (torbutton_check_socks_remote_dns())
+         remote_dns = liveprefs.getBoolPref("socks_remote_dns");
+    else
+         remote_dns = true;
+
+    return ( (liveprefs.getIntPref("type")           == 1)              &&
+             (liveprefs.getCharPref("http")          == torprefs.getCharPref('http_proxy'))   &&
+             (liveprefs.getIntPref("http_port")      == torprefs.getIntPref('http_port'))     &&
+             (liveprefs.getCharPref("ssl")           == torprefs.getCharPref('https_proxy'))  &&
+             (liveprefs.getIntPref("ssl_port")       == torprefs.getIntPref('https_port'))    &&
+             (liveprefs.getCharPref("ftp")           == torprefs.getCharPref('ftp_proxy'))    &&
+             (liveprefs.getIntPref("ftp_port")       == torprefs.getIntPref('ftp_port'))      &&
+             (liveprefs.getCharPref("gopher")        == torprefs.getCharPref('gopher_proxy')) &&
+             (liveprefs.getIntPref("gopher_port")    == torprefs.getIntPref('gopher_port'))   &&
+             (liveprefs.getCharPref("socks")         == torprefs.getCharPref('socks_host'))   &&
+             (liveprefs.getIntPref("socks_port")     == torprefs.getIntPref('socks_port'))    &&
+             (liveprefs.getIntPref("socks_version")  == 5)              &&
+             (liveprefs.getBoolPref("share_proxy_settings") == false)   &&
+             (remote_dns == true) );
+}
+
+function torbutton_activate_tor_settings()
+{
+  var liveprefs = false;
+  var torprefs = false;
+
+  liveprefs = torbutton_get_prefbranch('network.proxy.');
+  torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+  if (!liveprefs || !torprefs) return;
+
+  liveprefs.setCharPref('http',         torprefs.getCharPref('http_proxy'));
+  liveprefs.setIntPref('http_port',     torprefs.getIntPref('http_port'));
+  liveprefs.setCharPref('ssl',          torprefs.getCharPref('https_proxy'));
+  liveprefs.setIntPref('ssl_port',      torprefs.getIntPref('https_port'));
+  liveprefs.setCharPref('ftp',          torprefs.getCharPref('ftp_proxy'));
+  liveprefs.setIntPref('ftp_port',      torprefs.getIntPref('ftp_port'));
+  liveprefs.setCharPref('gopher',       torprefs.getCharPref('gopher_proxy'));
+  liveprefs.setIntPref('gopher_port',   torprefs.getIntPref('gopher_port'));
+  liveprefs.setCharPref('socks',        torprefs.getCharPref('socks_host'));
+  liveprefs.setIntPref('socks_port',    torprefs.getIntPref('socks_port'));
+  liveprefs.setIntPref('socks_version', 5);
+  liveprefs.setBoolPref('share_proxy_settings', false);
+  if (torbutton_check_socks_remote_dns()) {
+      liveprefs.setBoolPref('socks_remote_dns', true);
+  }
+  liveprefs.setIntPref('type', 1);
+
+  // XXX: hrmm.. This seems awfully inefficient
+  var torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+
+  if(torprefs.getBoolPref("no_tor_plugins")) {
+    torprefs.setBoolPref("allow_plugins", false);
+  }
+}
+

Modified: torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd
===================================================================
--- torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd	2007-05-31 07:20:44 UTC (rev 10416)
@@ -14,6 +14,11 @@
 <!ENTITY torbutton.prefs.proxy.host.gopher              "Gopher Proxy:">
 <!ENTITY torbutton.prefs.proxy.host.socks               "SOCKS Host:">
 <!ENTITY torbutton.prefs.proxy.port                     "Port:">
+<!ENTITY torbutton.prefs.sec_settings		"Security Settings">
+<!ENTITY torbutton.prefs.clear_history		"Clear history on Tor toggle (optional)">
+<!ENTITY torbutton.prefs.clear_cookies		"Clear cookies on Tor toggle (recommended)">
+<!ENTITY torbutton.prefs.disable_plugins	"Disable plugins during Tor usage (recommended)">
+<!ENTITY torbutton.prefs.kill_bad_js	    "Block dangerous javascript (recommended)">
 <!ENTITY torbutton.about.title                          "About Torbutton">
 <!ENTITY torbutton.pref_connection.notice               "Disable Torbutton to change these settings.">
 <!ENTITY torbutton.pref_connection.more_info            "More information">

Modified: torbutton/trunk/src/chrome/locale/en-US/torbutton.properties
===================================================================
--- torbutton/trunk/src/chrome/locale/en-US/torbutton.properties	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/locale/en-US/torbutton.properties	2007-05-31 07:20:44 UTC (rev 10416)
@@ -2,6 +2,8 @@
 torbutton.button.tooltip.enabled = Disable Tor
 torbutton.panel.tooltip.disabled = Click to enable Tor
 torbutton.panel.tooltip.enabled = Click to disable Tor
+torbutton.panel.plugins.disabled = Click to enable plugins
+torbutton.panel.plugins.enabled = Click to disable plugins
 torbutton.panel.label.disabled = Tor Disabled
 torbutton.panel.label.enabled = Tor Enabled
 extensions.{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}.description = Torbutton provides a button to easily enable or disable pointing Firefox to the Tor proxy

Added: torbutton/trunk/src/chrome/skin/p.png
===================================================================
(Binary files differ)


Property changes on: torbutton/trunk/src/chrome/skin/p.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: torbutton/trunk/src/chrome/skin/poff.png
===================================================================
(Binary files differ)


Property changes on: torbutton/trunk/src/chrome/skin/poff.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: torbutton/trunk/src/chrome/skin/punknown.png
===================================================================
(Binary files differ)


Property changes on: torbutton/trunk/src/chrome/skin/punknown.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: torbutton/trunk/src/chrome/skin/torbutton.css
===================================================================
--- torbutton/trunk/src/chrome/skin/torbutton.css	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/chrome/skin/torbutton.css	2007-05-31 07:20:44 UTC (rev 10416)
@@ -73,3 +73,16 @@
 toolbar[iconsize="small"] #torbutton-button-tb-msg[tbstatus="off"] {
   list-style-image: url("chrome://torbutton/skin/tor-disabled-16.png");
 }
+
+statusbarpanel#plugins-status {
+     list-style-image: url("chrome://torbutton/skin/punknown.png");
+}
+
+statusbarpanel#plugins-status[status="1"] {
+    list-style-image: url("chrome://torbutton/skin/p.png");
+}
+
+statusbarpanel#plugins-status[status="0"] {
+    list-style-image: url("chrome://torbutton/skin/poff.png");
+}
+

Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js	2007-05-31 03:47:41 UTC (rev 10415)
+++ torbutton/trunk/src/defaults/preferences/preferences.js	2007-05-31 07:20:44 UTC (rev 10416)
@@ -36,3 +36,11 @@
 pref("extensions.torbutton.saved.socks_host","");
 pref("extensions.torbutton.saved.socks_port",0);
 pref("extensions.{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}.description", "chrome://torbutton/locale/torbutton.properties");
+// XXX: Hrmm, what is the convention for above? do some of these belong in 
+// 'saved'?
+pref("extensions.torbutton.allow_plugins",true);
+pref("extensions.torbutton.no_tor_plugins",true);
+pref("extensions.torbutton.clear_cookies",true);
+pref("extensions.torbutton.clear_history",false);
+pref("extensions.torbutton.kill_bad_js",true);
+