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

[or-cvs] r20274: {torbutton} Made option for custom referrer spoofing. Made UI for cookie (in torbutton/branches/gsoc2009-koryk/src: chrome/content components defaults/preferences)



Author: koryk
Date: 2009-08-12 15:58:13 -0400 (Wed, 12 Aug 2009)
New Revision: 20274

Modified:
   torbutton/branches/gsoc2009-koryk/src/chrome/content/popup.xul
   torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.js
   torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.xul
   torbutton/branches/gsoc2009-koryk/src/chrome/content/torbutton.js
   torbutton/branches/gsoc2009-koryk/src/components/torRefSpoofer.js
   torbutton/branches/gsoc2009-koryk/src/defaults/preferences/preferences.js
Log:
Made option for custom referrer spoofing.
Made UI for cookie manager, and populated it with cookies (protection does not work yet).

Modified: torbutton/branches/gsoc2009-koryk/src/chrome/content/popup.xul
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/chrome/content/popup.xul	2009-08-12 14:53:53 UTC (rev 20273)
+++ torbutton/branches/gsoc2009-koryk/src/chrome/content/popup.xul	2009-08-12 19:58:13 UTC (rev 20274)
@@ -22,6 +22,12 @@
                   accesskey="&torbutton.context_menu.preferences.key;"
                   insertafter="context-stop"
                   oncommand="torbutton_open_prefs_dialog()"/>
+        <menuitem  id="torbutton-cookies" 
+                  label="Cookie Manager"
+                  accesskey="C"
+                  insertafter="context-stop"
+                  oncommand="window.openDialog('chrome://torbutton/content/torcookiedialog.xul','Cookie Manager',
+                                   'centerscreen,chrome,dialog,modal,resizable')"/>
         <menuitem id="torbutton-about"
                   label="&torbutton.context_menu.about;"
                   accesskey="&torbutton.context_menu.about.key;"

Modified: torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.js
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.js	2009-08-12 14:53:53 UTC (rev 20273)
+++ torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.js	2009-08-12 19:58:13 UTC (rev 20274)
@@ -240,7 +240,8 @@
             break;
     }
     
-    doc.getElementById('torbutton_refererSpoofGroup').selectedIndex = o_torprefs.getIntPref('refererspoof');
+    if ((doc.getElementById('torbutton_refererSpoofGroup').selectedIndex = o_torprefs.getIntPref('refererspoof'))==4)
+      doc.getElementById('torbutton_CustomRef').value = o_torprefs.getCharPref('customref');
     
     doc.getElementById('torbutton_torSessionStore').checked = !o_torprefs.getBoolPref('notor_sessionstore');
     doc.getElementById('torbutton_nonTorSessionStore').checked = !o_torprefs.getBoolPref('nonontor_sessionstore');
@@ -430,6 +431,8 @@
     
     o_torprefs.setBoolPref('locked_mode', doc.getElementById('torbutton_lockedMode').checked);
     o_torprefs.setIntPref('refererspoof',doc.getElementById('torbutton_refererSpoofGroup').selectedIndex);
+    if (doc.getElementById('torbutton_CustomReferer').selected)
+       o_torprefs.setCharPref('customref',doc.getElementById('torbutton_CustomRef').value);
     /*
     o_torprefs.setBoolPref('jar_certs', doc.getElementById('torbutton_jarCerts').checked);
     o_torprefs.setBoolPref('jar_ca_certs',

Modified: torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.xul
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.xul	2009-08-12 14:53:53 UTC (rev 20273)
+++ torbutton/branches/gsoc2009-koryk/src/chrome/content/preferences.xul	2009-08-12 19:58:13 UTC (rev 20274)
@@ -316,12 +316,14 @@
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
 -->
             <checkbox id="torbutton_spoofRefresh" label="&torbutton.prefs.spoofreresh;" oncommand="torbutton_prefs_set_field_attributes(document)" />
-            <radiogroup id="torbutton_refererSpoofGroup" label="&torbutton.prefs.refereroptions;">
+            <radiogroup id="torbutton_refererSpoofGroup" label="&torbutton.prefs.refereroptions;" oncommand="document.getElementById('torbutton_CustomRef').disabled = !document.getElementById('torbutton_CustomReferer').selected;">
               <radio id="torbutton_noRefSpoof" label="&torbutton.prefs.nospoof;" oncommand="torbutton_prefs_set_field_attributes(document)" />
               <radio id="torbutton_SpoofRoot" label="&torbutton.prefs.spoofroot;" selected="true" oncommand="torbutton_prefs_set_field_attributes(document)" />
               <radio id="torbutton_SpoofDomain" label="&torbutton.prefs.spoofdomain;" oncommand="torbutton_prefs_set_field_attributes(document)" />
               <radio id="torbutton_BlankReferer" label="&torbutton.prefs.spoofblank;" oncommand="torbutton_prefs_set_field_attributes(document)" />
+              <radio id="torbutton_CustomReferer" label="Custom Referer" />
             </radiogroup>
+           <textbox id="torbutton_CustomRef" value="" disabled="!document.getElementById('torbutton_CustomReferer').selected"/>
            </vbox>
           </tabpanel>
          </tabpanels>

Modified: torbutton/branches/gsoc2009-koryk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/chrome/content/torbutton.js	2009-08-12 14:53:53 UTC (rev 20273)
+++ torbutton/branches/gsoc2009-koryk/src/chrome/content/torbutton.js	2009-08-12 19:58:13 UTC (rev 20274)
@@ -443,8 +443,9 @@
 //if it is, then we show the two context menu items
 function torbutton_check_contextmenu() {
     var torurl = document.getElementById("torcontext-copyurl");
-    var tortab = document.getElementById("torcontext-opentorurl");
-    torurl.hidden = tortab.hidden = (document.popupNode.localName != "A") 
+    var tortab = document.getElementById("torcontext-opentortab");
+    var torwin = document.getElementById("torcontext-opentorwin");
+    torurl.hidden = tortab.hidden = torwin.hidden = (document.popupNode.localName != "A") 
 }
 function torbutton_copy_link() {
   var element = document.popupNode;

Modified: torbutton/branches/gsoc2009-koryk/src/components/torRefSpoofer.js
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/components/torRefSpoofer.js	2009-08-12 14:53:53 UTC (rev 20273)
+++ torbutton/branches/gsoc2009-koryk/src/components/torRefSpoofer.js	2009-08-12 19:58:13 UTC (rev 20274)
@@ -1,12 +1,11 @@
-
 function LOG(text)
 {
  var logger = Components.classes["@torproject.org/torbutton-logger;1"].getService(Components.interfaces.nsISupports).wrappedJSObject;
  logger.log("RefSpoof " + text);
   /*var prompt = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
                         .getService(Components.interfaces.nsIPromptService);
-  prompt.alert(null, "debug", text);*/
- 
+  prompt.alert(null, "debug", text);
+ */
 }
 
 
@@ -62,7 +61,10 @@
         //spoof no referer
         case 3:
           this.adjustRef(oHttpChannel, "");
-        break;      
+        break; 
+        case 4:
+          this.adjustRef(oHttpChannel, prefs.getCharPref("extensions.torbutton.customref"));
+        break;     
       }
       if (fake_refresh)      
         oHttpChannel.setRequestHeader("If-Modified-Since","Sat, 29 Oct 1989 19:43:31 GMT",false);

Modified: torbutton/branches/gsoc2009-koryk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/defaults/preferences/preferences.js	2009-08-12 14:53:53 UTC (rev 20273)
+++ torbutton/branches/gsoc2009-koryk/src/defaults/preferences/preferences.js	2009-08-12 19:58:13 UTC (rev 20274)
@@ -136,8 +136,9 @@
 pref("extensions.torbutton.tor_memory_jar",false);
 pref("extensions.torbutton.nontor_memory_jar",false);
 pref("extensions.torbutton.tz_string","");
-pref("extensions.torbutton.refererspoof", 0); //0=no spoof, 1=root spoof, 2=domain spoof, 3=blank spoof
+pref("extensions.torbutton.refererspoof", 0); //0=no spoof, 1=root spoof, 2=domain spoof, 3=blank spoof, 4=custom spoof
 pref("extensions.torbutton.fakerefresh", false);
+pref("extensions.torbutton.customeref","");
 
 // User agent prefs:
 pref("extensions.torbutton.appname_override","Netscape");