mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-19 07:35:48 +02:00
add new autofill on page load features
This commit is contained in:
parent
384b352a97
commit
396870e507
@ -3,12 +3,8 @@ document.addEventListener('DOMContentLoaded', event => {
|
|||||||
let filledThisHref = false;
|
let filledThisHref = false;
|
||||||
let delayFillTimeout: number;
|
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) => {
|
chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => {
|
||||||
if (msg.command === 'fillForm' && pageHref === msg.url) {
|
if (msg.command === 'fillForm' && pageHref === msg.url) {
|
||||||
filledThisHref = true;
|
filledThisHref = true;
|
||||||
|
@ -245,12 +245,16 @@ export default class AutofillService implements AutofillServiceInterface {
|
|||||||
if (fromCommand) {
|
if (fromCommand) {
|
||||||
cipher = await this.cipherService.getNextCipherForUrl(tab.url);
|
cipher = await this.cipherService.getNextCipherForUrl(tab.url);
|
||||||
} else {
|
} 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) {
|
if (lastLaunchedCipher && Date.now().valueOf() - lastLaunchedCipher.localData?.lastLaunched?.valueOf() < 30000) {
|
||||||
cipher = lastLaunchedCipher;
|
cipher = lastLaunchedCipher;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
|
cipher = await this.cipherService.getLastUsedForUrl(tab.url, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cipher === null) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user