[or-cvs] [torbutton/master] Bug #2421: Fix a popup-exception in FF4.0b10.

mikeperry at torproject.org mikeperry at torproject.org
Thu Feb 3 08:20:51 UTC 2011


commit b00643ecd3e1ce5c5caf428f5bb39ca95340f20e
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Thu Feb 3 00:19:59 2011 -0800

    Bug #2421: Fix a popup-exception in FF4.0b10.
    
    This doesn't fix the root issue of our JS hooks being broken, but that has
    existed since at least FF4.0b8. See #2465 for that issue.
---
 src/chrome/content/torbutton.js |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index b05f58b..4ee57c1 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -3853,16 +3853,26 @@ function torbutton_hookdoc(win, doc) {
     str2 += m_tb_jshooks;
 
     try {
+        var s = null;
         torbutton_log(2, "Type of window: " + typeof(win));
         torbutton_log(2, "Type of wrapped window: " + typeof(win.wrappedJSObject));
-        var s = new Components.utils.Sandbox(win.wrappedJSObject);
+        
+        // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=627494
+        // https://developer.mozilla.org/en/Components.utils.Sandbox#Optional_parameter
+        
+        if (m_tb_ff4) {
+           s = new Components.utils.Sandbox(win.wrappedJSObject,
+                   {  sandboxPrototype: win.wrappedJSObject,
+                      wantXrays: false });
+        } else {
+           s = new Components.utils.Sandbox(win.wrappedJSObject);
+        }
+
         // FIXME: FF3 issues 
         // http://developer.mozilla.org/en/docs/XPConnect_wrappers#XPCSafeJSObjectWrapper
         // http://developer.mozilla.org/en/docs/Code_snippets:Interaction_between_privileged_and_non-privileged_pages
         s.window = win.wrappedJSObject; 
-//        s.__proto__ = win.wrappedJSObject;
-        //var result = Components.utils.evalInSandbox('var origDate = Date; window.alert(new origDate())', s);
-        //result = 23;
+//s.__proto__ = win.wrappedJSObject;
         var result = Components.utils.evalInSandbox(str2, s);
         if(result === 23) { // secret confirmation result code.
             torbutton_log(3, "Javascript hooks applied successfully at: " + win.location);



More information about the tor-commits mailing list