[tor-commits] [torbutton/master] Bug #4058: Fix yet more issues with links opening in new tabs

mikeperry at torproject.org mikeperry at torproject.org
Sun Oct 2 03:42:07 UTC 2011


commit c725da03ecc54934eb52582a785ccedd4c012b4b
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Sat Oct 1 20:39:06 2011 -0700

    Bug #4058: Fix yet more issues with links opening in new tabs
    
    Fix is to only clear window.name for top-level windows, and to ignore
    frames/iframes.
---
 src/chrome/content/torbutton.js |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index decc37c..a9b8b59 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -4375,14 +4375,17 @@ function torbutton_hookdoc(win, doc, state_change, referrer) {
         // 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



More information about the tor-commits mailing list