1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

Merge branch 'master' into feature/sso

This commit is contained in:
Matt Smith
2020-08-19 15:08:09 -05:00
15 changed files with 595 additions and 1505 deletions

View File

@@ -3,5 +3,5 @@ import AutofillPageDetails from '../../models/autofillPageDetails';
export abstract class AutofillService {
getFormsWithPasswordFields: (pageDetails: AutofillPageDetails) => any[];
doAutoFill: (options: any) => Promise<string>;
doAutoFillForLastUsedLogin: (pageDetails: any, fromCommand: boolean) => Promise<string>;
doAutoFillActiveTab: (pageDetails: any, fromCommand: boolean) => Promise<string>;
}

View File

@@ -3,6 +3,8 @@ import {
FieldType,
} from 'jslib/enums';
import { CipherView } from 'jslib/models/view';
import AutofillField from '../models/autofillField';
import AutofillPageDetails from '../models/autofillPageDetails';
import AutofillScript from '../models/autofillScript';
@@ -117,6 +119,7 @@ var IsoProvinces: { [id: string]: string; } = {
/* tslint:enable */
export default class AutofillService implements AutofillServiceInterface {
constructor(private cipherService: CipherService, private userService: UserService,
private totpService: TotpService, private eventService: EventService) { }
@@ -217,23 +220,24 @@ export default class AutofillService implements AutofillServiceInterface {
}
}
async doAutoFillForLastUsedLogin(pageDetails: any, fromCommand: boolean) {
async doAutoFillActiveTab(pageDetails: any, fromCommand: boolean) {
const tab = await this.getActiveTab();
if (!tab || !tab.url) {
return;
}
const lastUsedCipher = await this.cipherService.getLastUsedForUrl(tab.url);
if (!lastUsedCipher) {
return;
let cipher: CipherView;
if (fromCommand) {
cipher = await this.cipherService.getNextCipherForUrl(tab.url);
} else {
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
}
return await this.doAutoFill({
cipher: lastUsedCipher,
// tslint:disable-next-line
cipher: cipher,
pageDetails: pageDetails,
skipTotp: !fromCommand,
skipLastUsed: true,
skipLastUsed: !fromCommand,
skipUsernameOnlyFill: !fromCommand,
onlyEmptyFields: !fromCommand,
onlyVisibleFields: !fromCommand,

View File

@@ -210,7 +210,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
if (this.isChrome() && text === '') {
text = '\u0000';
}
const textarea = doc.createElement('textarea');
textarea.textContent = text == null || text === '' ? ' ' : text;
// Prevent scrolling to bottom of page in MS Edge.