1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

dont attempt certain bg tasks when locked state

This commit is contained in:
Kyle Spearrin
2019-03-06 16:50:04 -05:00
parent f4496a6f15
commit 856776a7cf
5 changed files with 118 additions and 76 deletions

View File

@@ -1,15 +1,14 @@
import {
CipherService,
PlatformUtilsService,
} from 'jslib/abstractions';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { LockService } from 'jslib/abstractions/lock.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
export default class WebRequestBackground {
private pendingAuthRequests: any[] = [];
private webRequest: any;
private isFirefox: boolean;
constructor(private platformUtilsService: PlatformUtilsService,
private cipherService: CipherService) {
constructor(platformUtilsService: PlatformUtilsService, private cipherService: CipherService,
private lockService: LockService) {
this.webRequest = (window as any).chrome.webRequest;
this.isFirefox = platformUtilsService.isFirefox();
}
@@ -45,6 +44,11 @@ export default class WebRequestBackground {
}
private async resolveAuthCredentials(domain: string, success: Function, error: Function) {
if (await this.lockService.isLocked()) {
error();
return;
}
try {
const ciphers = await this.cipherService.getAllDecryptedForUrl(domain);
if (ciphers == null || ciphers.length !== 1) {