From 282e2eeaec9f0af97ec801fbad43e87ac5f71cc7 Mon Sep 17 00:00:00 2001 From: stoically Date: Sun, 4 Feb 2018 04:34:31 +0100 Subject: [PATCH] Fix Deletes History Container not cleaning history with deactivated automatic mode Part of #17 --- src/background/request.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/background/request.js b/src/background/request.js index 6ed5742d..89d566d2 100644 --- a/src/background/request.js +++ b/src/background/request.js @@ -16,15 +16,6 @@ class Request { debug('[browser.webRequest.onBeforeRequest] onBeforeRequest request doesnt belong to a tab, why are you main_frame?', request); return; } - let alwaysOpenIn = false; - if (this.shouldAlwaysOpenInTemporaryContainer(request)) { - debug('[browser.webRequest.onBeforeRequest] always open in tmpcontainer request', request); - alwaysOpenIn = true; - } else if (!this.storage.local.preferences.automaticMode && - !this.mouseclick.linksClicked[request.url]) { - debug('[browser.webRequest.onBeforeRequest] automatic mode disabled and no link clicked', request); - return; - } let tab; try { @@ -52,6 +43,16 @@ class Request { await this.storage.persist(); } + let alwaysOpenIn = false; + if (this.shouldAlwaysOpenInTemporaryContainer(request)) { + debug('[browser.webRequest.onBeforeRequest] always open in tmpcontainer request', request); + alwaysOpenIn = true; + } else if (!this.storage.local.preferences.automaticMode && + !this.mouseclick.linksClicked[request.url]) { + debug('[browser.webRequest.onBeforeRequest] automatic mode disabled and no link clicked', request); + return; + } + if (alwaysOpenIn && !this.mouseclick.linksClicked[request.url] && tab.openerTabId) { debug('[browser.webRequest.onBeforeRequest] always open in tmpcontainer request, simulating click', request); this.linkClicked(request.url, {