1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 04:03:29 +00:00

[BEEEP] Firefox Private Mode (#2294)

* Create background in popup if private mode, remove gates

* Add messaging support to runtime in private mode

* Fix messaging services and general bootstrap logic

* Add private mode warning, remove old component

* Deprecate launchGuardService

* Require in memory account for user to be considered authenticated

* Don't change icon for private mode windows

* Set all icons from background page
This commit is contained in:
Thomas Rittson
2022-02-16 08:06:35 +10:00
committed by GitHub
parent 7371ee344e
commit 06ba30fc6b
20 changed files with 192 additions and 135 deletions

View File

@@ -0,0 +1,8 @@
import { MessagingService } from "jslib-common/abstractions/messaging.service";
export default class BrowserMessagingPrivateModeBackgroundService implements MessagingService {
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
(window as any).bitwardenPopupMainMessageListener(message);
}
}

View File

@@ -0,0 +1,8 @@
import { MessagingService } from "jslib-common/abstractions/messaging.service";
export default class BrowserMessagingPrivateModePopupService implements MessagingService {
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
(window as any).bitwardenBackgroundMessageListener(message);
}
}

View File

@@ -18,6 +18,15 @@ export class StateService
await super.addAccount(account);
}
async getIsAuthenticated(options?: StorageOptions): Promise<boolean> {
// Firefox Private Mode can clash with non-Private Mode because they both read from the same onDiskOptions
// Check that there is an account in memory before considering the user authenticated
return (
(await super.getIsAuthenticated(options)) &&
(await this.getAccount(this.defaultInMemoryOptions)) != null
);
}
async getBrowserGroupingComponentState(
options?: StorageOptions
): Promise<BrowserGroupingsComponentState> {