[Pkg-mozext-commits] [adblock-plus] 216/464: WindowObserver: Fixed memory leak due to event listener not being removed

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:18 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 0274d53134f80563ea4bf4bcb587e1a72346e066
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Wed Jan 25 11:12:47 2012 +0100

    WindowObserver: Fixed memory leak due to event listener not being removed
---
 windowObserver.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/windowObserver.js b/windowObserver.js
index 5f62352..1db194d 100644
--- a/windowObserver.js
+++ b/windowObserver.js
@@ -73,11 +73,14 @@ WindowObserver.prototype =
       }
 
       let window = subject.QueryInterface(Ci.nsIDOMWindow);
-      window.addEventListener(this._when == "ready" ? "DOMContentLoaded" : "load", function()
+      let event = (this._when == "ready" ? "DOMContentLoaded" : "load");
+      let listener = function()
       {
+        window.removeEventListener(event, listener, false);
         if (this._shutdownHandler)
           this._listener.applyToWindow(window);
-      }.bind(this), false);
+      }.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