[or-cvs] r13798: Fix FF3 scoping issues in jshooks. (torbutton/trunk/src/chrome/content)

mikeperry at seul.org mikeperry at seul.org
Sun Mar 2 05:22:24 UTC 2008


Author: mikeperry
Date: 2008-03-02 00:22:23 -0500 (Sun, 02 Mar 2008)
New Revision: 13798

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

Fix FF3 scoping issues in jshooks.



Modified: torbutton/trunk/src/chrome/content/jshooks.js
===================================================================
--- torbutton/trunk/src/chrome/content/jshooks.js	2008-03-01 17:47:41 UTC (rev 13797)
+++ torbutton/trunk/src/chrome/content/jshooks.js	2008-03-02 05:22:23 UTC (rev 13798)
@@ -2,6 +2,7 @@
   if (typeof(window.__tb_hooks_ran) === "boolean") {
       return false;
   }
+  var win_is_FF3 = window.__tb_is_FF3;
  
   /* Hrmm.. Is it possible this breaks plugin install or other weird shit
      for non-windows OS's? */
@@ -269,8 +270,11 @@
 
   // FINALLY. We got a break! WAHOO ECMA-262 compliance!
   with(window) {
-      var XPCNativeWrapper = function(a) { return a; };
+      XPCNativeWrapper = function(a) { return a; };
   }
+  with(window.__proto__) {
+      XPCNativeWrapper = function(a) { return a; };
+  }
 
   // Gain access to the implict global object (which interestingly claims
   // to be a 'Window' but is not the same class as 'window'...) and 
@@ -278,16 +282,20 @@
   var tmp = new Object.prototype.toSource();
   var wintmp = window;
   with(window.valueOf.call()) {
-    for(var i in wintmp) {
-      if(i == "globalStorage" || i == "sessionStorage") {
-          //Causes an exception without this. 
-          //Disabled for now anyways.
-          tmp[i] = new Object();
-      } else {
-          tmp[i] = wintmp[i];                  
+      for(var i in wintmp) {
+          if(i == "globalStorage" || i == "sessionStorage") {
+              //Causes an exception without this. 
+              //Disabled for now anyways.
+              tmp[i] = new Object();
+          } else {
+              tmp[i] = wintmp[i];                  
+          }
       }
-    }
-    var __proto__ = tmp;
+      try { // FF3 throws an exception here
+          var __proto__ = tmp;
+      } catch(e) {
+          var __proto__ = null;
+      }
   }
 
   window.__proto__ = null; // Prevent delete from unmasking our properties.



More information about the tor-commits mailing list