converse-core: Call _tearDown when initialized again
When it's clear that a previous teardown didn't happen. So that objects can be garbage collected and that obsolete event handlers don't fire anymore.
This commit is contained in:
parent
bd81a98ffa
commit
008c07596a
|
@ -134,6 +134,15 @@
|
|||
settings = typeof settings !== "undefined" ? settings : {};
|
||||
var init_deferred = new $.Deferred();
|
||||
var converse = this;
|
||||
|
||||
if (typeof converse.chatboxes !== 'undefined') {
|
||||
// Looks like converse.initialized was called again without logging
|
||||
// out or disconnecting in the previous session.
|
||||
// This happens in tests.
|
||||
// We therefore first clean up.
|
||||
converse._tearDown();
|
||||
}
|
||||
|
||||
var unloadevent;
|
||||
if ('onpagehide' in window) {
|
||||
// Pagehide gets thrown in more cases than unload. Specifically it
|
||||
|
|
Loading…
Reference in New Issue
Block a user