From 396870e5070da860d6b2641e7495f198fef7c11a Mon Sep 17 00:00:00 2001 From: Tom Rittson Date: Tue, 27 Oct 2020 08:13:09 +1000 Subject: [PATCH] add new autofill on page load features --- src/content/autofiller.ts | 8 ++------ src/services/autofill.service.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/content/autofiller.ts b/src/content/autofiller.ts index 5e73c4a5c5..58de1c237b 100644 --- a/src/content/autofiller.ts +++ b/src/content/autofiller.ts @@ -3,12 +3,8 @@ document.addEventListener('DOMContentLoaded', event => { let filledThisHref = false; let delayFillTimeout: number; - const enabledKey = 'enableAutoFillOnPageLoad'; - chrome.storage.local.get(enabledKey, (obj: any) => { - if (obj != null && obj[enabledKey] === true) { - setInterval(() => doFillIfNeeded(), 500); - } - }); + setInterval(() => doFillIfNeeded(), 500); + chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => { if (msg.command === 'fillForm' && pageHref === msg.url) { filledThisHref = true; diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 841e27098d..6c9898f3d2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -245,12 +245,16 @@ export default class AutofillService implements AutofillServiceInterface { if (fromCommand) { cipher = await this.cipherService.getNextCipherForUrl(tab.url); } else { - const lastLaunchedCipher = await this.cipherService.getLastLaunchedForUrl(tab.url); + const lastLaunchedCipher = await this.cipherService.getLastLaunchedForUrl(tab.url, true); if (lastLaunchedCipher && Date.now().valueOf() - lastLaunchedCipher.localData?.lastLaunched?.valueOf() < 30000) { cipher = lastLaunchedCipher; } else { - cipher = await this.cipherService.getLastUsedForUrl(tab.url); + cipher = await this.cipherService.getLastUsedForUrl(tab.url, true); + } + + if (cipher === null) { + return null; } }