Merge pull request #20 from keepassxreboot/clear_logins_fix

Prevent multiple page_clear_logins
This commit is contained in:
Janek Bevendorff 2018-02-28 00:43:12 +01:00 committed by GitHub
commit d2eb986289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -256,8 +256,10 @@ kpxcEvent.onMultipleFieldsPopup = function(callback, tab) {
browserAction.show(null, tab);
};
kpxcEvent.pageClearLogins = function(callback, tab) {
page.clearLogins(tab.id);
kpxcEvent.pageClearLogins = function(callback, tab, alreadyCalled) {
if (!alreadyCalled) {
page.clearLogins(tab.id);
}
callback();
};

View file

@ -1,6 +1,7 @@
// contains already called method names
var _called = {};
_called.retrieveCredentials = false;
_called.clearLogins = false;
_called.manualFillRequested = 'none';
// Count of detected form fields on the page
@ -1213,7 +1214,8 @@ cip.initCredentialFields = function(forceCall) {
}
_called.initCredentialFields = true;
browser.runtime.sendMessage({ 'action': 'page_clear_logins' }).then(() => {
browser.runtime.sendMessage({ 'action': 'page_clear_logins', args: [_called.clearLogins] }).then(() => {
_called.clearLogins = true;
const inputs = cipFields.getAllFields();
cipFields.prepareVisibleFieldsWithID('select');
cip.initPasswordGenerator(inputs);

View file

@ -1,6 +1,6 @@
$(function() {
browser.runtime.getBackgroundPage().then((global) => {
browser.tabs.query({"active": true, "currentWindow": true}).then((tabs) => {
browser.tabs.query({'active': true, 'currentWindow': true}).then((tabs) => {
if (tabs.length === 0) {
return; // For example: only the background devtools or a popup are opened
}