From 955ef60292ac5d847877796d5cc249c3e599b8f8 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 18 Feb 2015 11:23:13 -0800 Subject: [PATCH] Fix list_view-related error in background page Background page conversations were trying to trigger events on the inbox list view which had been destroyed, resulting in a background page console error of "can't read innerHeight of null". Avoid this by removing listeners when the inbox window is closed. --- js/views/inbox_view.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 0e5a496b..04c5c5b4 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -35,6 +35,9 @@ }).render(); window.addEventListener('resize', this.inbox.resize.bind(this.inbox)); + window.addEventListener('beforeunload', function () { + this.inbox.stopListening(); + }.bind(this)); }, events: { 'keyup': 'keyup',