[or-cvs] [torbutton/master 29/47] Forgot to properly scope a variable for query redirect.

mikeperry at torproject.org mikeperry at torproject.org
Thu Sep 30 16:20:15 UTC 2010


Author: Mike Perry <mikeperry-git at fscked.org>
Date: Sun, 4 Apr 2010 03:35:19 -0700
Subject: Forgot to properly scope a variable for query redirect.
Commit: 824ab512378105a7ba26da7121b7aad1fd8b593e

Wow, this was an annoying regression.
---
 src/chrome/content/torbutton.js |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 33697d0..eee4d93 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -2743,22 +2743,13 @@ function torbutton_check_google_captcha(subject, topic, data) {
           var wm = Components.classes["@torproject.org/content-window-mapper;1"]
              .getService(Components.interfaces.nsISupports)
              .wrappedJSObject;
-          if(wind.top instanceof Components.interfaces.nsIDOMChromeWindow) {
-            if(wind.top.browserDOMWindow) {
-              // This never seems to work. Leaving it in just in case
-              // for optimizations sake.
-              torbutton_log(3, "Got browser window for 302");
-              browser = wind.top.getBrowser().selectedTab.linkedBrowser;
-            }
-          }
-          if (!browser)
-            browser = wm.getBrowserForContentWindow(wind.window.top);
+          browser = wm.getBrowserForContentWindow(wind.window.top);
         } catch(e) {
           torbutton_log(4, "Exception on google captcha logging: "+e);
         }
       }
 
-      querymatch = subject.URI.path.match("[\?\&]q=([^&]+)(?:[\&]|$)");
+      var querymatch = subject.URI.path.match("[\?\&]q=([^&]+)(?:[\&]|$)");
       if (!querymatch) {
         torbutton_safelog(4, "No Google query found for captcha in: ",
                 subject.URI.spec);
@@ -2766,6 +2757,8 @@ function torbutton_check_google_captcha(subject, topic, data) {
       }
       var newUrl = m_tb_prefs.getCharPref("extensions.torbutton.redir_url."+
                     m_tb_prefs.getIntPref("extensions.torbutton.google_redir_url"));
+      var query=newUrl+querymatch[1];
+      torbutton_safelog(3, "Got Google query: ",query);
 
       if (!m_tb_prefs.getBoolPref("extensions.torbutton.asked_google_captcha")) {
         var check = {value: false};
@@ -2800,11 +2793,12 @@ function torbutton_check_google_captcha(subject, topic, data) {
           return;
         }
       }
+      torbutton_safelog(3, "Still have Google query: ",query);
       // Split url into [?&]q=...[&$]
       if (browser)
-        browser.loadURI(newUrl+querymatch[1], null, subject.URI.originCharset);
+        browser.loadURI(query, null, subject.URI.originCharset);
       else
-        httpChannel.setResponseHeader("Location", newUrl+querymatch[1], false);
+        httpChannel.setResponseHeader("Location", query, false);
       torbutton_log(4, "Got Google Captcha. Redirecting");
     }
   }
-- 
1.7.1




More information about the tor-commits mailing list