[or-cvs] r13860: Woah, that truck came at us from a totally different directi (in torbutton/trunk/src: chrome/content components)
mikeperry at seul.org
mikeperry at seul.org
Tue Mar 4 19:40:58 UTC 2008
Author: mikeperry
Date: 2008-03-04 14:40:58 -0500 (Tue, 04 Mar 2008)
New Revision: 13860
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
torbutton/trunk/src/components/cssblocker.js
Log:
Woah, that truck came at us from a totally different
direction. And is masqueraded as a jeep! We need a bandaid
over here too.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2008-03-04 18:01:59 UTC (rev 13859)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2008-03-04 19:40:58 UTC (rev 13860)
@@ -1539,7 +1539,7 @@
}
torbutton_log(2, "Hooking document: "+win.location);
- if(doc.doctype) {
+ if(doc && doc.doctype) {
torbutton_log(2, "Type: "+doc.doctype.name);
}
@@ -1568,7 +1568,6 @@
str2 += "window.__tb_oscpu=\""+m_tb_prefs.getCharPref('extensions.torbutton.oscpu_override')+"\";\r\n";
str2 += "window.__tb_platform=\""+m_tb_prefs.getCharPref('extensions.torbutton.platform_override')+"\";\r\n";
str2 += "window.__tb_productSub=\""+m_tb_prefs.getCharPref('extensions.torbutton.productsub_override')+"\";\r\n";
- str2 += "window.__tb_block_js_history="+m_tb_prefs.getBoolPref('extensions.torbutton.block_js_history')+";\r\n";
str2 += m_tb_jshooks;
try {
@@ -1582,11 +1581,11 @@
} else if(result === 13) {
torbutton_log(3, "Double-hook at: " + win.location);
} else {
- win.alert("Sandbox evaluation failed. Date hooks not applied!");
+ window.alert("Sandbox evaluation failed. Date hooks not applied!");
torbutton_log(5, "Hook evaluation failure at " + win.location);
}
} catch (e) {
- win.alert("Exception in sandbox evaluation. Date hooks not applied:\n"+e);
+ window.alert("Exception in sandbox evaluation. Date hooks not applied:\n"+e);
torbutton_log(5, "Hook exception at: "+win.location+", "+e);
}
@@ -1613,10 +1612,9 @@
DOMWindow = aRequest.notificationCallbacks.QueryInterface(
Components.interfaces.nsIInterfaceRequestor).getInterface(
Components.interfaces.nsIDOMWindow);
- } catch(e) {
- }
+ } catch(e) { }
}
-
+
// FIXME if intstanceof nsIHttpChannel check headers for
// Content-Disposition..
@@ -1630,12 +1628,14 @@
&& chanreq instanceof Components.interfaces.nsIChannel
&& aRequest.isPending()) {
- torbutton_eclog(2, 'Pending request: '+aRequest.name);
+ try { torbutton_eclog(2, 'Pending request: '+aRequest.name); }
+ catch(e) { }
if(DOMWindow && DOMWindow.opener
&& m_tb_prefs.getBoolPref("extensions.torbutton.isolate_content")) {
- torbutton_eclog(3, 'Popup request: '+aRequest.name);
+ try { torbutton_eclog(3, 'Popup request: '+aRequest.name); }
+ catch(e) { }
if(!(DOMWindow.top instanceof Components.interfaces.nsIDOMChromeWindow)) {
// Workaround for Firefox bug 409737
Modified: torbutton/trunk/src/components/cssblocker.js
===================================================================
--- torbutton/trunk/src/components/cssblocker.js 2008-03-04 18:01:59 UTC (rev 13859)
+++ torbutton/trunk/src/components/cssblocker.js 2008-03-04 19:40:58 UTC (rev 13860)
@@ -140,9 +140,11 @@
}
if(!this.isolate_content) {
- this.logger.eclog(1, "Content policy disabled");
+ this.logger.eclog(2, "Content policy disabled");
return ok;
}
+
+ this.logger.log(2, "Cpolicy load of: "+contentLocation.spec+" from: "+requestOrigin.spec);
// "Host-free" schemes do not have an nsIURI.host property
if(contentLocation.scheme in hostFreeSchemes) {
@@ -151,7 +153,7 @@
}
if(requestOrigin &&
(requestOrigin.scheme in safeOriginSchemes)) {
- this.logger.eclog(1, "Skipping chrome-sourced local: "+contentLocation.spec);
+ this.logger.eclog(2, "Skipping chrome-sourced local: "+contentLocation.spec);
return ok;
} else if(contentLocation.spec.toLowerCase().indexOf("torbutton") != -1 || this.tor_enabled) {
this.logger.eclog(4, "Blocking local: "+contentLocation.spec+" from: "+requestOrigin.spec);
@@ -180,10 +182,10 @@
// Local stuff has to be eclog because otherwise debuglogger will
// get into an infinite log-loop w/ its chrome updates
if (this.isLocalScheme(contentLocation.scheme)) {
- this.logger.eclog(1, "Skipping local: "+contentLocation.spec);
+ this.logger.eclog(2, "Skipping local: "+contentLocation.spec);
return ok;
- }
-
+ }
+
var node = wrapNode(insecNode);
var wind = getWindow(node);
@@ -232,6 +234,18 @@
return block;
}
+ // For javascript links (and others?) the normal http events
+ // for the weblistener in torbutton.js are suppressed
+ if(tor_state && node instanceof Ci.nsIDOMWindow) {
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var chrome = wm.getMostRecentWindow("navigator:browser");
+
+ this.logger.eclog(2, "Hooking iframe domwindow");
+ // It doesn't really matter which chome window does the hooking.
+ chrome.torbutton_hookdoc(node, null);
+ }
+
// source window of browser chrome window with a document content
// type means the user entered a new URL.
if(wind.top instanceof Components.interfaces.nsIDOMChromeWindow) {
@@ -259,7 +273,7 @@
if(browser.__tb_tor_fetched == tor_state) {
return ok;
} else {
- this.logger.log(3, "Blocking redirect: "+contentLocation.spec);
+ this.logger.log(4, "Blocking redirect: "+contentLocation.spec);
return block;
}
}
@@ -271,7 +285,7 @@
if(browser.__tb_tor_fetched == tor_state) {
return ok;
} else {
- this.logger.log(3, "Blocking: "+contentLocation.spec);
+ this.logger.log(4, "Blocking: "+contentLocation.spec);
return block;
}
},
More information about the tor-commits
mailing list