1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[bug] Properly define stored window state (#638)

This commit is contained in:
Addison Beck
2022-01-27 10:44:09 -05:00
committed by GitHub
parent 0186610ca4
commit 83305313f9
5 changed files with 25 additions and 18 deletions

View File

@@ -36,6 +36,7 @@ import { BehaviorSubject } from "rxjs";
import { StateMigrationService } from "../abstractions/stateMigration.service";
import { EnvironmentUrls } from "../models/domain/environmentUrls";
import { WindowState } from "../models/domain/windowState";
const keys = {
global: "global",
@@ -2066,14 +2067,14 @@ export class StateService<TAccount extends Account = Account>
await this.saveGlobals(globals, await this.defaultOnDiskOptions());
}
async getWindow(): Promise<Map<string, any>> {
async getWindow(): Promise<WindowState> {
const globals = await this.getGlobals(await this.defaultOnDiskOptions());
return globals?.window != null && Object.keys(globals.window).length > 0
? globals.window
: new Map<string, any>();
: new WindowState();
}
async setWindow(value: Map<string, any>, options?: StorageOptions): Promise<void> {
async setWindow(value: WindowState, options?: StorageOptions): Promise<void> {
const globals = await this.getGlobals(
this.reconcileOptions(options, await this.defaultOnDiskOptions())
);