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:
@@ -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);
|
||||
}
|
||||
}
|
||||
8
src/services/browserMessagingPrivateModePopup.service.ts
Normal file
8
src/services/browserMessagingPrivateModePopup.service.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user