[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r14356: Prevent popup windows from displaying at all if the opener's (torbutton/trunk/src/chrome/content)
Author: mikeperry
Date: 2008-04-11 02:40:38 -0400 (Fri, 11 Apr 2008)
New Revision: 14356
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
Log:
Prevent popup windows from displaying at all if the opener's
tor state is different than the current state.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2008-04-11 04:13:52 UTC (rev 14355)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2008-04-11 06:40:38 UTC (rev 14356)
@@ -1227,7 +1227,9 @@
if (topic == "http-on-examine-response") {
torbutton_eclog(3, 'Definitaly Examine response: '+subject.name);
torbutton_check_progress(null, subject);
- }
+ } else if (topic == "http-on-modify-request") {
+ torbutton_eclog(3, 'Modify request: '+subject.name);
+ }
},
register : function() {
var observerService =
@@ -1235,6 +1237,7 @@
getService(Components.interfaces.nsIObserverService);
torbutton_log(3, "Observer register");
+ observerService.addObserver(this, "http-on-modify-request", false);
observerService.addObserver(this, "http-on-examine-response", false);
torbutton_log(3, "Observer register");
},
@@ -1243,6 +1246,7 @@
Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
+ observerService.removeObserver(this,"http-on-modify-request");
observerService.removeObserver(this,"http-on-examine-response");
}
}
@@ -1675,12 +1679,18 @@
torbutton_eclog(3, 'Got browser for request: ' + (browser != null));
if(browser && browser.__tb_tor_fetched != m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled")) {
- torbutton_eclog(3, 'Stopping document: '+DOMWindow.location);
- aRequest.cancel(0x804b0002); // NS_BINDING_ABORTED
- DOMWindow.stop();
- torbutton_eclog(3, 'Stopped document: '+DOMWindow.location);
- DOMWindow.document.clear();
- torbutton_eclog(3, 'Cleared document: '+DOMWindow.location);
+ try {
+ torbutton_eclog(3, 'Stopping document: '+DOMWindow.location);
+ aRequest.cancel(0x804b0002); // NS_BINDING_ABORTED
+ DOMWindow.stop();
+ torbutton_eclog(3, 'Stopped document: '+DOMWindow.location);
+ DOMWindow.document.clear();
+ torbutton_eclog(3, 'Cleared document: '+DOMWindow.location);
+ } catch(e) {
+ }
+ torbutton_eclog(4, 'Torbutton blocked state-changed popup');
+ DOMWindow.close();
+ return 0;
}
}
}