[Pkg-mozext-commits] [adblock-plus] 229/464: Backed out revision 10cb63148b5c (work-around for memory leaks caused by bug 721319) - the bug has been fixed
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 61015314924dd3fbc33e4676f17c77cc9a90ea12
Author: Wladimir Palant <trev at adblockplus.org>
Date: Tue Feb 28 07:59:00 2012 +0100
Backed out revision 10cb63148b5c (work-around for memory leaks caused by bug 721319) - the bug has been fixed
---
windowObserver.js | 38 +++++---------------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
diff --git a/windowObserver.js b/windowObserver.js
index bf60761..1db194d 100644
--- a/windowObserver.js
+++ b/windowObserver.js
@@ -17,32 +17,19 @@ exports.WindowObserver = WindowObserver;
* @param {String} [when] when to execute applyToWindow(). "start" means immediately
* when the window opens, "ready" when its contents are available
* and "end" (default) means to wait until the "load" event.
- * @param {Boolean} [ignoreUnloads] Do not work around bug 721319 by calling
- * removeFromWindow() when the window unloads.
* @constructor
*/
-function WindowObserver(listener, when, ignoreUnloads)
+function WindowObserver(listener, when)
{
this._listener = listener;
this._when = when;
- if (ignoreUnloads)
- this._unloadHandler = null;
- else
- {
- // Ugly bug 721319 work-around
- this._unloadHandler = function(event)
- {
- this.removeFromWindow(event.target.defaultView);
- }.bind(this);
- }
-
let e = Services.ww.getWindowEnumerator();
while (e.hasMoreElements())
{
let window = e.getNext().QueryInterface(Ci.nsIDOMWindow);
if (when == "start" || window.document.readyState == "complete")
- this.applyToWindow(window);
+ this._listener.applyToWindow(window);
else
this.observe(window, "domwindowopened", null);
}
@@ -53,7 +40,7 @@ function WindowObserver(listener, when, ignoreUnloads)
{
let e = Services.ww.getWindowEnumerator();
while (e.hasMoreElements())
- this.removeFromWindow(e.getNext().QueryInterface(Ci.nsIDOMWindow));
+ this._listener.removeFromWindow(e.getNext().QueryInterface(Ci.nsIDOMWindow));
Services.ww.unregisterNotification(this);
}.bind(this);
@@ -64,7 +51,6 @@ WindowObserver.prototype =
_listener: null,
_when: null,
_shutdownHandler: null,
- _unloadHandler: null,
shutdown: function()
{
@@ -76,27 +62,13 @@ WindowObserver.prototype =
this._shutdownHandler = null;
},
- applyToWindow: function(window)
- {
- if (this._unloadHandler)
- window.addEventListener("unload", this._unloadHandler, false);
- this._listener.applyToWindow(window);
- },
-
- removeFromWindow: function(window)
- {
- if (this._unloadHandler)
- window.removeEventListener("unload", this._unloadHandler, false);
- this._listener.removeFromWindow(window);
- },
-
observe: function(subject, topic, data)
{
if (topic == "domwindowopened")
{
if (this._when == "start")
{
- this.applyToWindow(window);
+ this._listener.applyToWindow(window);
return;
}
@@ -106,7 +78,7 @@ WindowObserver.prototype =
{
window.removeEventListener(event, listener, false);
if (this._shutdownHandler)
- this.applyToWindow(window);
+ this._listener.applyToWindow(window);
}.bind(this);
window.addEventListener(event, listener, false);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list