[Pkg-mozext-commits] [itsalltext] 324/459: Double check the unlisten.

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository itsalltext.

commit a185ceb04ca0ac34f9da7372538923d22e2d562e
Author: Christian Höltje <docwhat at gmail.com>
Date:   Wed Oct 22 19:02:11 2008 -0400

    Double check the unlisten.
---
 src/chrome/content/itsalltext.js | 4 ++++
 src/chrome/content/monitor.js    | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index 13494ac..1967977 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -893,8 +893,12 @@ ItsAllText.prototype.listen = function (source, event, listener, opt_capture) {
 ItsAllText.prototype.unlisten = function (source, event, listener, opt_capture) {
     opt_capture = !!opt_capture;
     this.debug("unlisten(%o, %o, -, %o)", source, event, opt_capture);
+    try {
     Components.lookupMethod(source, "removeEventListener")(
         event, listener, opt_capture);
+    } catch(err) {
+        this.debug("didn't unlisten: %o", err);
+    }
 };
 
 /**
diff --git a/src/chrome/content/monitor.js b/src/chrome/content/monitor.js
index 897e91f..feacf69 100644
--- a/src/chrome/content/monitor.js
+++ b/src/chrome/content/monitor.js
@@ -153,7 +153,9 @@ new_monitor.prototype.hitched_stopPage = function (event) {
     this.iat.debug('stopPage', doc && doc.location);
 
     unsafeWin = doc.defaultView.wrappedJSObject;
-    this.iat.unlisten(unsafeWin, 'pagehide', this.stopPage);
+    if (unsafeWin) {
+        this.iat.unlisten(unsafeWin, 'pagehide', this.stopPage);
+    }
 };
 
 new_monitor.prototype.isXUL = function (doc) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git



More information about the Pkg-mozext-commits mailing list