mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Filter out hidden input fields instantly in getInputs()
This commit is contained in:
parent
7cea76abf8
commit
20e59267e4
1 changed files with 13 additions and 3 deletions
|
|
@ -1239,17 +1239,27 @@ cipObserverHelper.ignoredNode = function(target) {
|
|||
};
|
||||
|
||||
cipObserverHelper.getInputs = function(target) {
|
||||
// Ignores target element if it's not an element node
|
||||
if (cipObserverHelper.ignoredNode(target)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const input = target.getElementsByTagName('input');
|
||||
if (input.length === 0 || input.length > _maximumInputs) {
|
||||
// Filter out any input fields with type 'hidden' right away
|
||||
let inputFields = [];
|
||||
Array.from(target.getElementsByTagName('input')).forEach(e => {
|
||||
if (e.type !== 'hidden') {
|
||||
inputFields.push(e);
|
||||
}
|
||||
});
|
||||
|
||||
// Do not allow more visible inputs than _maximumInputs (default value: 100)
|
||||
if (inputFields.length === 0 || inputFields.length > _maximumInputs) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Only include input fields that match with cipObserverHelper.inputTypes
|
||||
let inputs = [];
|
||||
for (const i of input) {
|
||||
for (const i of inputFields) {
|
||||
if (cipObserverHelper.inputTypes.includes(i.getAttribute('type'))) {
|
||||
inputs.push(i);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue