get forms anyway even if no matches

This commit is contained in:
Evert Prants 2022-08-28 10:39:55 +03:00
parent caea4f90fd
commit 8f380ed30b
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 10 additions and 7 deletions

View File

@ -3,6 +3,7 @@
let currentForm = null;
let successfulAttachment = false;
let focusedField = null;
let loginForms = [];
function generateQuerySelector(el) {
if (el.tagName.toLowerCase() === 'html') {
@ -184,10 +185,9 @@
});
}
function init() {
const forms = lookForLoginForms();
if (forms.length) {
forms.forEach((form) => attachLoginFormHighlight(form));
function createFormHighlights() {
if (loginForms.length) {
loginForms.forEach((form) => attachLoginFormHighlight(form));
}
}
@ -209,7 +209,7 @@
) {
if (request.message === 'has_entries') {
currentPageMatches = request.payload;
init();
createFormHighlights();
sendResponse(true);
}
@ -244,7 +244,9 @@
}
if (e.target && e.target.tagName === 'INPUT') {
init();
createFormHighlights();
}
});
loginForms = lookForLoginForms();
})();

View File

@ -36,7 +36,8 @@ async function findSiteInPasswords(siteDomain) {
.filter((item) => {
const name = item.toLowerCase();
return name.includes(siteDomain) || (sdwTLD && name.includes(sdwTLD));
});
})
.slice(0, 4);
}
async function getPassword(password) {