Prevent multiple page_clear_logins

This commit is contained in:
varjolintu 2018-02-26 10:45:16 +02:00
parent 2ba5571654
commit 48e07d96c1
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
}