[Pkg-mozext-commits] [SCM] torbutton Debian packaging branch, master, updated. debian/1.4.4.1-1

Jérémy Bobbio lunar at debian.org
Tue Oct 18 22:00:30 UTC 2011


The following commit has been merged in the master branch:
commit 15fe92ac2eea645886bd8a44dd46fd866139066f
Merge: d149005614a2045511db4644eed92bcf75e0ca58 7c94dc6f6358165f8826eaf559baecdcd5fe2bd0
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Tue Oct 18 21:55:22 2011 +0200

    Merge remote branch 'upstream/master'
    
    Drop debian/patches/fix-loading-of-system-homepage.patch;
    merged upstream.

diff --combined debian/patches/series
index 545a79a,0000000..b6e7e79
mode 100644,000000..100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@@ -1,3 -1,0 +1,2 @@@
 +localhost-proxy.patch
 +restore-status-panel-on-ff4.patch
- fix-loading-of-system-homepage.patch
diff --combined src/chrome/content/torbutton.js
index afaa37b,966e574..d0b2461
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@@ -300,6 -300,8 +300,8 @@@ var torbutton_unique_pref_observer 
                  torbutton_update_status(
                          m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled"),
                          true);
+             // XXX: We should try to get rid of these warnings now that toggle
+             // is not supported in TBB.
              case "extensions.torbutton.disable_domstorage":
              case "extensions.torbutton.no_updates":
              case "extensions.torbutton.no_search":
@@@ -350,18 -352,10 +352,18 @@@ function torbutton_set_panel_view() 
      if (!o_statuspanel || !o_prefbranch) return;
  
      // Firefox 4 has no toolbar panel
 -    var display_panel = o_prefbranch.getBoolPref('display_panel')
 -        && !m_tb_ff4;
 +    var display_panel = o_prefbranch.getBoolPref('display_panel');
      torbutton_log(2, 'setting panel visibility');
      o_statuspanel.setAttribute('collapsed', !display_panel);
 +
 +    // Prevent the FF4 nav bar from making our menu invisible...
 +    var o_toolbutton = torbutton_get_toolbutton();
 +    if (o_toolbutton) {
 +      var context = document.getElementById('torbutton-context-menu');
 +      context.style.visibility = "visible";
 +      context.hidden = false;
 +      torbutton_log(3, "Set new context menu.");
 +    }
  }
  
  function torbutton_set_panel_style() {
@@@ -475,6 -469,16 +477,6 @@@ function torbutton_init_toolbutton(
  {
      try {
        torbutton_log(3, "Initializing the Torbutton button.");
 -      // Prevent the FF4 status bar from making our menu invisible...
 -      /* Not needed
 -      var o_toolbutton = torbutton_get_toolbutton();
 -      if (o_toolbutton) {
 -        var context = document.getElementById('torbutton-context-menu');
 -        context.style.visibility = "visible";
 -        context.hidden = false;
 -        torbutton_log(3, "Set new context menu.");
 -      }
 -      */
        torbutton_update_toolbutton(torbutton_check_status());
      } catch(e) {
        torbutton_log(4, "Error Initializing Torbutton button: "+e);
@@@ -523,6 -527,15 +525,15 @@@ function torbutton_init() 
          // FIXME: We might want a check to use to set this in the future,
          // but this works fine for now.
          m_tb_tbb = true;
+     } else if (environ.exists("TOR_CONTROL_COOKIE_AUTH_FILE")) {
+         var cookie_path = environ.get("TOR_CONTROL_COOKIE_AUTH_FILE");
+         try {
+             if ("" != cookie_path) {
+                 m_tb_control_pass = torbutton_read_authentication_cookie(cookie_path);
+             }
+         } catch(e) {
+             torbutton_log(4, 'unable to read authentication cookie');
+         }
      }
  
      if (environ.exists("TOR_CONTROL_PORT")) {
@@@ -710,7 -723,7 +721,7 @@@ function torbutton_init_prefs() 
                  torprefs.setBoolPref('use_privoxy', true);
  
              if (torprefs.getBoolPref('use_privoxy')) {
 -                proxy_host = '127.0.0.1';
 +                proxy_host = 'localhost';
                  proxy_port = 8118;
              } else {
                  proxy_host = '';
@@@ -741,22 -754,6 +752,6 @@@
              torprefs.setIntPref('https_port', proxy_port);
              torprefs.setIntPref('ftp_port', proxy_port);
          }
- 
-         var environ = Components.classes["@mozilla.org/process/environment;1"]
-                    .getService(Components.interfaces.nsIEnvironment);
- 
-         if (environ.exists("TOR_SOCKS_PORT")) {
-           torprefs.setIntPref('socks_port', parseInt(environ.get("TOR_SOCKS_PORT")));
-         } else {
-           torprefs.setIntPref('socks_port', 9050);
-         }
- 
-         if (environ.exists("TOR_SOCKS_HOST")) {
-           torprefs.setCharPref('socks_host', environ.get("TOR_SOCKS_HOST"));
-         } else {
-           torprefs.setCharPref('socks_host', '127.0.0.1');
-         }
- 
      }
  
      torbutton_log(1, 'http_port='+torprefs.getIntPref('http_port'));
@@@ -1228,14 -1225,11 +1223,11 @@@ function torbutton_set_timezone(mode, s
  function torbutton_get_general_useragent_locale() {
     try {
          var locale = m_tb_prefs.getCharPref("general.useragent.locale");
-         if (locale != "chrome://global/locale/intl.properties") {
-             return locale;
+         if (/chrome:\/\//.test(locale)) {
+             return m_tb_prefs.getComplexValue("general.useragent.locale",
+                        Components.interfaces.nsIPrefLocalizedString).data;
          }
- 
-         var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
-                                 .getService(Components.interfaces.nsIStringBundleService);
-         var stringbundle = bundle.createBundle(locale);
-         return stringbundle.GetStringFromName("general.useragent.locale");
+         return locale;
      } catch(err) {
          torbutton_log(4, "Error while getting general.useragent.locale:" + err);
          return 'en-US';
@@@ -1302,6 -1296,27 +1294,27 @@@ function torbutton_socket_readline(inpu
    return str;
  }
  
+ function torbutton_read_authentication_cookie(path) {
+   var file = Components.classes['@mozilla.org/file/local;1']
+              .createInstance(Components.interfaces.nsILocalFile);
+   file.initWithPath(path);
+   var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1']
+                    .createInstance(Components.interfaces.nsIFileInputStream);
+   fileStream.init(file, 1, 0, false);
+   var binaryStream = Components.classes['@mozilla.org/binaryinputstream;1']
+                      .createInstance(Components.interfaces.nsIBinaryInputStream);
+   binaryStream.setInputStream(fileStream);
+   var array = binaryStream.readByteArray(fileStream.available());
+   binaryStream.close();
+   fileStream.close();
+   return torbutton_array_to_hexdigits(array);
+ }
+ 
+ function torbutton_array_to_hexdigits(array) {
+   return array.map(function(c) {
+                      return String("0" + c.toString(16)).slice(-2)
+                    }).join('');
+ };
  // Executes a command on the control port.
  // Return 0 in error, 1 for success.
  function torbutton_send_ctrl_cmd(command) {
@@@ -1312,8 -1327,8 +1325,8 @@@
      var input = socket.openInputStream(3, 0, 0); // 3 == OPEN_BLOCKING|OPEN_UNBUFFERED
      var output = socket.openOutputStream(3, 0, 0); // 3 == OPEN_BLOCKING|OPEN_UNBUFFERED
  
-     inputStream     = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream);
-     outputStream    = Cc["@mozilla.org/binaryoutputstream;1"].createInstance(Ci.nsIBinaryOutputStream);
+     var inputStream     = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream);
+     var outputStream    = Cc["@mozilla.org/binaryoutputstream;1"].createInstance(Ci.nsIBinaryOutputStream);
  
      inputStream.setInputStream(input);
      outputStream.setOutputStream(output);
@@@ -1497,6 -1512,9 +1510,9 @@@ function torbutton_new_identity() 
      }
    }
  
+   // gBrowser should always be here.
+   torbutton_set_window_size(gBrowser.contentWindow);
+ 
    torbutton_log(3, "New identity successful");
  
  }
@@@ -1822,8 -1840,16 +1838,16 @@@ function torbutton_update_status(mode, 
                      false, mode, changed);
              torbutton_setBoolPref("signon.rememberSignons", "remember_signons", 
                      false, mode, changed);
+         } else {
+             torbutton_setBoolPref("browser.formfill.enable", "formfill",
+                     true, mode, changed);
+             torbutton_setBoolPref("signon.rememberSignons", "remember_signons", 
+                     true, mode, changed);
          }
  
+         torbutton_setBoolPref("signon.autofillForms", "autofillForms",
+                 false, mode, changed);
+ 
          if (m_tb_ff4) {
              if(m_tb_prefs.getBoolPref('extensions.torbutton.block_thwrite')) {
                  m_tb_prefs.setBoolPref("places.history.enabled", false);
@@@ -1850,6 -1876,10 +1874,10 @@@
              torbutton_setBoolPref("signon.rememberSignons", "remember_signons", 
                      false, mode, changed);
          }
+ 
+         torbutton_setBoolPref("signon.autofillForms", "autofillForms",
+                 true, mode, changed);
+ 
          if (m_tb_ff4) {
              if(m_tb_prefs.getBoolPref('extensions.torbutton.block_nthwrite')) {
                  m_tb_prefs.setBoolPref("places.history.enabled", false);
@@@ -2796,18 -2826,28 +2824,28 @@@ function torbutton_tag_new_browser(brow
      }
  }
  
- function torbutton_reload_homepage() {
-     var homepage = m_tb_prefs.getCharPref("browser.startup.homepage");
-     if (homepage.match(/chrome:\/\/.*\.properties$/)) {
-         try {
-             var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
-                                     .getService(Components.interfaces.nsIStringBundleService);
-             var stringbundle = bundle.createBundle(homepage);
-             homepage = stringbundle.GetStringFromName("browser.startup.homepage");
-         } catch(err) {
-             torbutton_log(4, "Error while getting browser.startup.homepage:" + err);
-         }
+ function torbutton_do_versioncheck() {
+   if (m_tb_tbb && m_tb_prefs.getBoolPref("extensions.torbutton.versioncheck_enabled")) {
+     var is_updated = torbutton_check_version();
+     var locale = m_tb_prefs.getCharPref("general.useragent.locale");
+     if (is_updated == 0) {
+       // In an ideal world, we'd just check for hasUserValue, but we can't do
+       // that, because we set browser.startup.homepage to have a user value already...
+       m_tb_prefs.setCharPref("browser.startup.homepage",
+               "https://check.torproject.org/?lang="+locale+"&small=1&uptodate=0");
+     } else if (is_updated == 1) {
+       var homepage = m_tb_prefs.getCharPref("browser.startup.homepage");
+       if (homepage.indexOf("https://check.torproject.org/") == 0) {
+         m_tb_prefs.setCharPref("browser.startup.homepage",
+                   "https://check.torproject.org/?lang="+locale+"&small=1&uptodate=1");
+       }
      }
+   }
+ }
+ 
+ function torbutton_reload_homepage() {
+     var homepage = m_tb_prefs.getComplexValue("browser.startup.homepage",
+                        Components.interfaces.nsIPrefLocalizedString).data;
      gBrowser.loadURI(homepage, null, null);
  }
  
@@@ -2870,22 -2910,7 +2908,7 @@@ function torbutton_set_launch_state(sta
  
          // Load our homepage again. We just killed it via the toggle.
          if (!session_restore) {
-           if (m_tb_tbb && m_tb_prefs.getBoolPref("extensions.torbutton.versioncheck_enabled")) {
-             var is_updated = torbutton_check_version();
-             var locale = m_tb_prefs.getCharPref("general.useragent.locale");
-             if (is_updated == 0) {
-               // In an ideal world, we'd just check for hasUserValue, but we can't do
-               // that, because we set browser.startup.homepage to have a user value already...
-               m_tb_prefs.setCharPref("browser.startup.homepage",
-                       "https://check.torproject.org/?lang="+locale+"&small=1&uptodate=0");
-             } else if (is_updated == 1) {
-               var homepage = m_tb_prefs.getCharPref("browser.startup.homepage");
-               if (homepage.indexOf("https://check.torproject.org/") == 0) {
-                 m_tb_prefs.setCharPref("browser.startup.homepage",
-                           "https://check.torproject.org/?lang="+locale+"&small=1&uptodate=1");
-               }
-             }
-           }
+           torbutton_do_versioncheck();
            torbutton_reload_homepage();
          }
        } else {
@@@ -2899,6 -2924,7 +2922,7 @@@
  
          // Load our homepage again. We just killed it via the toggle.
          if (!session_restore) {
+             torbutton_do_versioncheck();
              torbutton_reload_homepage();
          }
      }
@@@ -3172,6 -3198,8 +3196,8 @@@ function torbutton_regen_google_cookie(
      if (!m_tb_hidden_browser) {
        torbutton_init_hidden_browser();
      }
+     // XXX: This is might be forbidden according to 
+     // https://bugzilla.mozilla.org/show_bug.cgi?id=608628
      m_tb_hidden_browser.addProgressListener(torbutton_google_cookie_regen_listener,
                          Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
  
@@@ -3855,6 -3883,27 +3881,27 @@@ function torbutton_do_startup(
            torbutton_new_google_cookie();
          }
  
+         var environ = Components.classes["@mozilla.org/process/environment;1"]
+                    .getService(Components.interfaces.nsIEnvironment);
+ 
+         if (environ.exists("TOR_SOCKS_PORT")) {
+           m_tb_prefs.setIntPref('extensions.torbutton.socks_port', parseInt(environ.get("TOR_SOCKS_PORT")));
+           if (m_tb_tbb) {
+               m_tb_prefs.setIntPref('network.proxy.socks_port', parseInt(environ.get("TOR_SOCKS_PORT")));
+           }
+         } else {
+           m_tb_prefs.setIntPref('extensions.torbutton.socks_port', 9050);
+         }
+ 
+         if (environ.exists("TOR_SOCKS_HOST")) {
+           m_tb_prefs.setCharPref('extensions.torbutton.socks_host', environ.get("TOR_SOCKS_HOST"));
+           if (m_tb_tbb) {
+               m_tb_prefs.setCharPref('network.proxy.socks', environ.get("TOR_SOCKS_HOST"));
+           }
+         } else {
+           m_tb_prefs.setCharPref('extensions.torbutton.socks_host', '127.0.0.1');
+         }
+ 
          m_tb_prefs.setBoolPref("extensions.torbutton.startup", false);
      }
  }
@@@ -4344,14 -4393,17 +4391,17 @@@ function torbutton_hookdoc(win, doc, st
          // The about:blank check handles the 'name' attribute of framesets, which
          // get set before the referer is set on the channel.
          if ((!referrer || referrer.spec == "") && win.location != "about:blank") {
-             win.name = "";
-             win.window.name = "";
+             if (win.top == win.window) {
+                 // Only reset if we're the top-level window
+                 //torbutton_log(4, "Resetting window.name: "+win.name+" for "+win.location);
+                 win.name = "";
+                 win.window.name = "";
+             }
          }
      } catch(e) {
          torbutton_log(4, "Failed to reset window.name: "+e)
      }
  
-     
      var js_enabled = m_tb_prefs.getBoolPref("javascript.enabled");
  
      // No need to hook js if tor is off

-- 
torbutton Debian packaging



More information about the Pkg-mozext-commits mailing list