From d19fcd6e4ccf062b595c2823267ffd32fd8e5a3d Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 25 Oct 2017 23:07:00 -0400 Subject: [PATCH] autofill script fixes --- src/content/autofill.js | 9 ++++++++- src/content/notificationBar.js | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/content/autofill.js b/src/content/autofill.js index 878a9ca289..841eaefdc1 100644 --- a/src/content/autofill.js +++ b/src/content/autofill.js @@ -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 diff --git a/src/content/notificationBar.js b/src/content/notificationBar.js index 29b6229153..d07b286bd3 100644 --- a/src/content/notificationBar.js +++ b/src/content/notificationBar.js @@ -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) {