diff options
author | flo-mic <52607335+flo-mic@users.noreply.github.com> | 2021-02-21 20:29:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-21 20:29:39 +0300 |
commit | 17c79a284397c9556f8a44e48a9a92466f8145c5 (patch) | |
tree | d4a4410515a1bc0a35b3d0c145ca038b0f15ae60 | |
parent | 9e2dead569998d5897aad949f4beb64d1d88e41b (diff) |
fix autofill not working on page load
-rw-r--r-- | src/js/Manager/AutofillManager.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/js/Manager/AutofillManager.js b/src/js/Manager/AutofillManager.js index 7b4e141..51d024d 100644 --- a/src/js/Manager/AutofillManager.js +++ b/src/js/Manager/AutofillManager.js @@ -10,6 +10,9 @@ export default new class AutofillManager { this._recommendationListener = (recommendations) => { this._sendAutofillPassword(recommendations); }; + this._sendPasswordToMessageService = (recommendations) => { + this._sendPwdToMessageService(recommendations); + }; } /** @@ -27,13 +30,24 @@ export default new class AutofillManager { async _sendAutofillPassword(recommendations) { if(recommendations.length === 0 || await SettingsService.getValue('paste.autofill') === false) return; let password = recommendations[0]; + var self = this; - let ids = TabManager.get('autofill.ids', []); - if(ids.indexOf(password.getId()) === -1) { - ids.push(password.getId()); - TabManager.set('autofill.ids', ids); - } + setTimeout(function () { + let ids = TabManager.get('autofill.ids', []); + if(ids.indexOf(password.getId()) === -1) { + ids.push(password.getId()); + TabManager.set('autofill.ids', ids); + } + self._sendPasswordToMessageService(password); + }, 2500); + } + /** + * + * @param {Password[]} recommendations + * @private + */ + _sendPwdToMessageService(password) { MessageService.send( { type : 'autofill.password', @@ -49,4 +63,4 @@ export default new class AutofillManager { } ).catch(ErrorManager.catchEvt); } -};
\ No newline at end of file +}; |