1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

Merge pull request #1886 from bitwarden/fix-private-mode-page

Don't start popup services if in private mode
This commit is contained in:
Thomas Rittson 2021-06-08 14:25:32 -07:00 committed by GitHub
commit 957f356dbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,12 +65,14 @@ function getBgService<T>(service: string) {
};
}
const isPrivateMode = BrowserApi.getBackgroundPage() == null;
const stateService = new StateService();
const messagingService = new BrowserMessagingService();
const searchService = new PopupSearchService(getBgService<SearchService>('searchService')(),
const searchService = isPrivateMode ? null : new PopupSearchService(getBgService<SearchService>('searchService')(),
getBgService<CipherService>('cipherService')(), getBgService<ConsoleLogService>('consoleLogService')(),
getBgService<I18nService>('i18nService')());
const passwordRepromptService = new PasswordRepromptService(getBgService<I18nService>('i18nService')(),
const passwordRepromptService = isPrivateMode ? null : new PasswordRepromptService(getBgService<I18nService>('i18nService')(),
getBgService<CryptoService>('cryptoService')(), getBgService<PlatformUtilsService>('platformUtilsService')());
export function initFactory(platformUtilsService: PlatformUtilsService, i18nService: I18nService, storageService: StorageService,
@ -84,7 +86,7 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ
window.document.body.classList.add('body-sm');
}
if (BrowserApi.getBackgroundPage() != null) {
if (!isPrivateMode) {
await stateService.save(ConstantsService.disableFaviconKey,
await storageService.get<boolean>(ConstantsService.disableFaviconKey));