From 43a86a7495d46ef6b5ce81fc6cd0781afb155582 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 21 Oct 2020 23:52:49 +0200 Subject: [PATCH] Destroy old pageInfo instance when initializing WU --- src/ext/uw.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ext/uw.js b/src/ext/uw.js index 702105b..e5a2e3f 100644 --- a/src/ext/uw.js +++ b/src/ext/uw.js @@ -155,6 +155,10 @@ class UW { } try { + if (this.pageInfo) { + this.logger.log('info', 'debug', '[uw.js::setup] An instance of pageInfo already exists and will be destroyed.'); + this.pageInfo.destroy(); + } this.pageInfo = new PageInfo(this.comms, this.settings, this.logger, extensionMode, isSiteDisabled); this.logger.log('info', 'debug', "[uw.js::setup] pageInfo initialized."); @@ -162,6 +166,9 @@ class UW { // start action handler only if extension is enabled for this site if (!isSiteDisabled) { + if (this.actionHandler) { + this.actionHandler.destroy(); + } this.actionHandler = new ActionHandler(this.pageInfo); this.actionHandler.init();