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

View File

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