1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-08 09:32:07 +01:00

autofill script fixes

This commit is contained in:
Kyle Spearrin 2017-10-25 23:07:00 -04:00
parent ebf06a66c5
commit d19fcd6e4c
2 changed files with 14 additions and 2 deletions

View File

@ -35,10 +35,13 @@
2. Remove isChrome and isSafari since they are not used.
3. Unminify and format to meet Mozilla review requirements.
4. Remove unnecessary input types from getFormElements query selector and limit number of elements returned.
5. Remove fakeTested prop.
*/
function collect(document, undefined) {
// START MODIFICATION
var isFirefox = navigator.userAgent.indexOf('Firefox') !== -1 || navigator.userAgent.indexOf('Gecko/') !== -1;
// END MODIFICATION
document.elementsByOPID = {};
document.addEventListener('input', function (canuf) {
@ -309,7 +312,9 @@
field.form = getElementAttrValue(el.form, 'opid');
}
addProp(field, 'fakeTested', checkIfFakeTested(field, el), false);
// START MODIFICATION
//addProp(field, 'fakeTested', checkIfFakeTested(field, el), false);
// END MODIFICATION
return field;
});
@ -549,6 +554,7 @@
// get all the form elements that we care about
function getFormElements(theDoc, limit) {
// START MODIFICATION
var els = [];
try {
var elsList = theDoc.querySelectorAll('input:not([type="hidden"]):not([type="submit"]):not([type="reset"])' +
@ -557,6 +563,7 @@
} catch (e) { }
return limit && els.length > limit ? els.slice(0, limit) : els;
// END MODIFICATION
}
// focus the element and optionally restore its original value

View File

@ -6,6 +6,7 @@
observer = null,
domObservationCollectTimeout = null,
collectIfNeededTimeout = null,
observeDomTimeout = null,
iframed = isIframed(),
submitButtonNames = ['log in', 'sign in', 'login', 'go', 'submit', 'continue', 'next'];
@ -130,7 +131,11 @@
}
collect();
observeDom();
if (observeDomTimeout) {
clearTimeout(observeDomTimeout);
}
observeDomTimeout = setTimeout(observeDom, 1000);
}
if (collectIfNeededTimeout) {