Commit 0f9c8fc7 authored by Kathleen Brade's avatar Kathleen Brade Committed by Georg Koppen
Browse files

Bug 21201: Avoid accessing contentWindow inside torbutton_resizelistener.

Also, use Cc, Ci, and Cr inside torbutton_resizelistener.
parent 7fffae28
...@@ -2204,26 +2204,16 @@ var torbutton_resizelistener = ...@@ -2204,26 +2204,16 @@ var torbutton_resizelistener =
{ {
QueryInterface: function(aIID) QueryInterface: function(aIID)
{ {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) || if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports)) aIID.equals(Ci.nsISupports))
return this; return this;
throw Components.results.NS_NOINTERFACE; throw Cr.NS_NOINTERFACE;
}, },
onLocationChange: function(aProgress, aRequest, aURI) {}, onLocationChange: function(aProgress, aRequest, aURI) {},
onStateChange: function(aProgress, aRequest, aFlag, aStatus) { onStateChange: function(aProgress, aRequest, aFlag, aStatus) {
if (aFlag & Components.interfaces.nsIWebProgressListener.STATE_STOP) { if (aFlag & Ci.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;
}
m_tb_resize_handler = function() { m_tb_resize_handler = function() {
if (window.windowState === 1) { if (window.windowState === 1) {
if (m_tb_prefs. if (m_tb_prefs.
...@@ -2301,6 +2291,8 @@ var torbutton_resizelistener = ...@@ -2301,6 +2291,8 @@ var torbutton_resizelistener =
// event got fired. Thus, we have the rather klunky setTimeout() call. // event got fired. Thus, we have the rather klunky setTimeout() call.
window.addEventListener("sizemodechange", m_tb_resize_handler, false); window.addEventListener("sizemodechange", m_tb_resize_handler, false);
let progress = Cc["@mozilla.org/docloaderservice;1"]
.getService(Ci.nsIWebProgress);
progress.removeProgressListener(this); progress.removeProgressListener(this);
} }
}, // onStateChange }, // onStateChange
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment