From 5b5a3fcc840dc5132d5639c7517cf6f5eba8fbb0 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Wed, 28 Feb 2018 10:39:13 +0200 Subject: [PATCH] Choose credential fields works with multiple windows visible --- keepassxc-browser/popups/popup_functions.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/keepassxc-browser/popups/popup_functions.js b/keepassxc-browser/popups/popup_functions.js index f78182c..206938b 100644 --- a/keepassxc-browser/popups/popup_functions.js +++ b/keepassxc-browser/popups/popup_functions.js @@ -15,11 +15,16 @@ function initSettings() { }); $('#settings #btn-choose-credential-fields').click(function() { - browser.runtime.getBackgroundPage().then((global) => { - browser.tabs.sendMessage(global.page.currentTabId, { - action: 'choose_credential_fields' + browser.windows.getCurrent().then((win) => { + browser.tabs.query({ 'active': true, 'currentWindow': true }).then((tabs) => { + const tab = tabs[0]; + browser.runtime.getBackgroundPage().then((global) => { + browser.tabs.sendMessage(tab.id, { + action: 'choose_credential_fields' + }); + close(); + }); }); - close(); }); }); }