From 71ea60e44ad884d146eac699f7367bf0eda7d49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Thu, 7 May 2015 12:47:32 -0300 Subject: [PATCH 1/2] Fixed an error that appears when unload event is triggered This happens when you load a page with converse and do not login to the chat. It can be tested in converse.org preserving logs while navigating to another page. Inside clearSession there's a call to roster which is not initalized and also another one to controlbox.save which is not set so it fails with an url error during sync. --- converse.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/converse.js b/converse.js index f24956fbe..5ad6f95bf 100644 --- a/converse.js +++ b/converse.js @@ -569,10 +569,13 @@ }; this.clearSession = function () { - this.roster.browserStorage._clear(); + if (this.roster) { + this.roster.browserStorage._clear(); + } this.session.browserStorage._clear(); - var controlbox = converse.chatboxes.get('controlbox'); - controlbox.save({'connected': false}); + if (converse.connection.connected) { + converse.chatboxes.get('controlbox').save({'connected': false}); + } }; this.setSession = function () { From ef305fff55faa9859746d4c8569e9f844fbc4127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Thu, 7 May 2015 12:59:36 -0300 Subject: [PATCH 2/2] Updated CHANGES.rst --- docs/CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index 02e78664d..134b52f15 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -6,6 +6,7 @@ Changelog * Refactored in order to remove the strophe.roster.js dependency. [jcbrand] * Bugfix. Manual login doesn't work when only websocket_url is set and not bosh_service_url. [jcbrand] +* Bugfix. clearSessions during unload event would throw an error when not logged in. [gbonvehi] 0.9.3 (2015-05-01) ------------------