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

[or-cvs] r14745: Ugh, navigator useragent masking hooks were broken in 1.1.18 (torbutton/trunk/src/chrome/content)



Author: mikeperry
Date: 2008-05-27 01:45:13 -0400 (Tue, 27 May 2008)
New Revision: 14745

Modified:
   torbutton/trunk/src/chrome/content/jshooks.js
   torbutton/trunk/src/chrome/content/torbutton.js
Log:

Ugh, navigator useragent masking hooks were broken in 1.1.18.
Woops.



Modified: torbutton/trunk/src/chrome/content/jshooks.js
===================================================================
--- torbutton/trunk/src/chrome/content/jshooks.js	2008-05-27 02:45:18 UTC (rev 14744)
+++ torbutton/trunk/src/chrome/content/jshooks.js	2008-05-27 05:45:13 UTC (rev 14745)
@@ -72,9 +72,9 @@
                   // XPCNative objects are special for some reason. So far, 
                   // all we have are "plugins" and mimeTypes, which 
                   // are empty anyways. Disable them.
-                  if(tmpNav[i].toString().indexOf("XPCNative") != -1) {
-                      window.navigator[i] = tmpNav[i];
-                      continue;
+                  //if(tmpNav[i].toString().indexOf("XPCNative") != -1) {
+                  if(i === "plugins" || i === "mimeTypes") {
+                      tmpNav[i] = new Array();
                   }
                   (function() { // crazy scope hack to preserve i
                       var holder = i;

Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2008-05-27 02:45:18 UTC (rev 14744)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2008-05-27 05:45:13 UTC (rev 14745)
@@ -2088,7 +2088,16 @@
         str2 += "window.__tb_hook_date=false;\r\n";
     } else {
         str2 += "window.__tb_hook_date=true;\r\n";
-        str2 += "window.__tb_set_uagent="+m_tb_prefs.getBoolPref('extensions.torbutton.set_uagent')+";\r\n";
+        if(m_tb_prefs.getBoolPref("extensions.torbutton.no_tor_plugins")) {
+            str2 += "window.__tb_set_uagent="+m_tb_prefs.getBoolPref('extensions.torbutton.set_uagent')+";\r\n";
+        } else {
+            // Abandon ship on user agent spoofing if user wants plugins.
+            // OS+platform can be obtained from plugins anyways, and complications
+            // with XPCNativeWrappers makes it hard to provide
+            // plugin information in window.navigator properly with plugins
+            // enabled.
+            str2 += "window.__tb_set_uagent=false;\r\n";
+        }
         str2 += "window.__tb_oscpu=\""+m_tb_prefs.getCharPref('extensions.torbutton.oscpu_override')+"\";\r\n";
         str2 += "window.__tb_platform=\""+m_tb_prefs.getCharPref('extensions.torbutton.platform_override')+"\";\r\n";
         str2 += "window.__tb_productSub=\""+m_tb_prefs.getCharPref('extensions.torbutton.productsub_override')+"\";\r\n";