[tor-commits] [torbutton/master] Bug 21201: Avoid accessing contentWindow inside torbutton_resizelistener.
gk at torproject.org
gk at torproject.org
Tue Apr 4 08:59:53 UTC 2017
commit 0f9c8fc79b9e0c3411c2aedf18ad24b4596172a0
Author: Kathy Brade <brade at pearlcrescent.com>
Date: Thu Feb 9 11:37:20 2017 -0500
Bug 21201: Avoid accessing contentWindow inside torbutton_resizelistener.
Also, use Cc, Ci, and Cr inside torbutton_resizelistener.
---
src/chrome/content/torbutton.js | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 44f01f9..f521a6c 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -2204,26 +2204,16 @@ var torbutton_resizelistener =
{
QueryInterface: function(aIID)
{
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onLocationChange: function(aProgress, aRequest, aURI) {},
onStateChange: function(aProgress, aRequest, aFlag, aStatus) {
- if (aFlag & Components.interfaces.nsIWebProgressListener.STATE_STOP) {
- var progress =
- Components.classes["@mozilla.org/docloaderservice;1"].
- getService(Components.interfaces.nsIWebProgress);
- var win = getBrowser().contentWindow;
- if (!win || typeof(win) == "undefined") {
- torbutton_log(5, "No initial browser content window?");
- progress.removeProgressListener(this);
- return;
- }
-
+ if (aFlag & Ci.nsIWebProgressListener.STATE_STOP) {
m_tb_resize_handler = function() {
if (window.windowState === 1) {
if (m_tb_prefs.
@@ -2301,6 +2291,8 @@ var torbutton_resizelistener =
// event got fired. Thus, we have the rather klunky setTimeout() call.
window.addEventListener("sizemodechange", m_tb_resize_handler, false);
+ let progress = Cc["@mozilla.org/docloaderservice;1"]
+ .getService(Ci.nsIWebProgress);
progress.removeProgressListener(this);
}
}, // onStateChange
More information about the tor-commits
mailing list