Skip to content
Permalink
Browse files

Destroy session objects in `clearSession`, not in `tearDown`

  • Loading branch information...
jcbrand committed Jun 1, 2019
1 parent dc58e6d commit 55cffab594902c428378a6940c4560c816850632
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/headless/converse-core.js
@@ -410,14 +410,6 @@ function initClientConfig () {

function tearDown () {
_converse.api.trigger('beforeTearDown');
if (!_.isUndefined(_converse.bosh_session)) {
_converse.bosh_session.destroy();
delete _converse.bosh_session;
}
if (!_.isUndefined(_converse.session)) {
_converse.session.destroy();
delete _converse.session;
}
window.removeEventListener('click', _converse.onUserActivity);
window.removeEventListener('focus', _converse.onUserActivity);
window.removeEventListener('keypress', _converse.onUserActivity);
@@ -444,6 +436,14 @@ function clearSession () {
window.localStorage.clear();
window.sessionStorage.clear();
} else {
if (!_.isUndefined(_converse.bosh_session)) {
_converse.bosh_session.destroy();
delete _converse.bosh_session;
}
if (!_.isUndefined(_converse.session)) {
_converse.session.destroy();
delete _converse.session;
}
_.get(_converse, 'bosh_session.browserStorage', {'_clear': _.noop})._clear();
_.get(_converse, 'session.browserStorage', {'_clear': _.noop})._clear();
}

0 comments on commit 55cffab

Please sign in to comment.
You can’t perform that action at this time.