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

switch from session storage to memory storage (#644)

This commit is contained in:
Kyle Spearrin
2020-09-08 13:47:20 -04:00
committed by GitHub
parent 11cf89493d
commit e14a676eea

View File

@@ -9,6 +9,7 @@ export class HtmlStorageService implements StorageService {
ConstantsService.vaultTimeoutKey, ConstantsService.vaultTimeoutActionKey, ConstantsService.ssoCodeVerifierKey,
ConstantsService.ssoStateKey, 'ssoOrgIdentifier']);
private localStorageStartsWithKeys = ['twoFactorToken_', ConstantsService.collapsedGroupingsKey + '_'];
private sessionMemoryStorage = new Map<string, string>()
constructor(private platformUtilsService: PlatformUtilsService) { }
@@ -31,7 +32,7 @@ export class HtmlStorageService implements StorageService {
if (this.isLocalStorage(key)) {
json = window.localStorage.getItem(key);
} else {
json = window.sessionStorage.getItem(key);
json = this.sessionMemoryStorage.get(key);
}
if (json != null) {
const obj = JSON.parse(json);
@@ -49,7 +50,7 @@ export class HtmlStorageService implements StorageService {
if (this.isLocalStorage(key)) {
window.localStorage.setItem(key, json);
} else {
window.sessionStorage.setItem(key, json);
this.sessionMemoryStorage.set(key, json);
}
return Promise.resolve();
}
@@ -58,7 +59,7 @@ export class HtmlStorageService implements StorageService {
if (this.isLocalStorage(key)) {
window.localStorage.removeItem(key);
} else {
window.sessionStorage.removeItem(key);
this.sessionMemoryStorage.delete(key);
}
return Promise.resolve();
}