mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
switch from session storage to memory storage (#644)
This commit is contained in:
@@ -9,6 +9,7 @@ export class HtmlStorageService implements StorageService {
|
|||||||
ConstantsService.vaultTimeoutKey, ConstantsService.vaultTimeoutActionKey, ConstantsService.ssoCodeVerifierKey,
|
ConstantsService.vaultTimeoutKey, ConstantsService.vaultTimeoutActionKey, ConstantsService.ssoCodeVerifierKey,
|
||||||
ConstantsService.ssoStateKey, 'ssoOrgIdentifier']);
|
ConstantsService.ssoStateKey, 'ssoOrgIdentifier']);
|
||||||
private localStorageStartsWithKeys = ['twoFactorToken_', ConstantsService.collapsedGroupingsKey + '_'];
|
private localStorageStartsWithKeys = ['twoFactorToken_', ConstantsService.collapsedGroupingsKey + '_'];
|
||||||
|
private sessionMemoryStorage = new Map<string, string>()
|
||||||
|
|
||||||
constructor(private platformUtilsService: PlatformUtilsService) { }
|
constructor(private platformUtilsService: PlatformUtilsService) { }
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ export class HtmlStorageService implements StorageService {
|
|||||||
if (this.isLocalStorage(key)) {
|
if (this.isLocalStorage(key)) {
|
||||||
json = window.localStorage.getItem(key);
|
json = window.localStorage.getItem(key);
|
||||||
} else {
|
} else {
|
||||||
json = window.sessionStorage.getItem(key);
|
json = this.sessionMemoryStorage.get(key);
|
||||||
}
|
}
|
||||||
if (json != null) {
|
if (json != null) {
|
||||||
const obj = JSON.parse(json);
|
const obj = JSON.parse(json);
|
||||||
@@ -49,7 +50,7 @@ export class HtmlStorageService implements StorageService {
|
|||||||
if (this.isLocalStorage(key)) {
|
if (this.isLocalStorage(key)) {
|
||||||
window.localStorage.setItem(key, json);
|
window.localStorage.setItem(key, json);
|
||||||
} else {
|
} else {
|
||||||
window.sessionStorage.setItem(key, json);
|
this.sessionMemoryStorage.set(key, json);
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@@ -58,7 +59,7 @@ export class HtmlStorageService implements StorageService {
|
|||||||
if (this.isLocalStorage(key)) {
|
if (this.isLocalStorage(key)) {
|
||||||
window.localStorage.removeItem(key);
|
window.localStorage.removeItem(key);
|
||||||
} else {
|
} else {
|
||||||
window.sessionStorage.removeItem(key);
|
this.sessionMemoryStorage.delete(key);
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user