diff --git a/src/popup/app/app.js b/src/popup/app/app.js index 9965cb5e0b..51f7ce21db 100644 --- a/src/popup/app/app.js +++ b/src/popup/app/app.js @@ -33,13 +33,16 @@ import { U2f } from '../../scripts/u2f'; window.U2f = U2f; import { Analytics } from '../../../jslib/src/misc/analytics'; -new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => { - const bgPage = BrowserApi.getBackgroundPage(); - if (!bgPage || !bgPage.bitwardenMain) { - throw 'Cannot resolve background page main.'; - } - return bgPage.bitwardenMain; -}); + +if (BrowserApi.getBackgroundPage()) { + new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => { + const bgPage = BrowserApi.getBackgroundPage(); + if (!bgPage || !bgPage.bitwardenMain) { + throw 'Cannot resolve background page main.'; + } + return bgPage.bitwardenMain; + }); +} // Model imports import { Attachment } from '../../../jslib/src/models/domain/attachment'; diff --git a/src/popup/app/services/services.module.ts b/src/popup/app/services/services.module.ts index 0330066425..698355b7be 100644 --- a/src/popup/app/services/services.module.ts +++ b/src/popup/app/services/services.module.ts @@ -13,7 +13,10 @@ const authService = new AuthService(backgroundServices.cryptoService(), backgrou backgroundServices.userService(), backgroundServices.tokenService(), backgroundServices.appIdService(), backgroundServices.i18n2Service(), backgroundServices.platformUtilsService(), backgroundServices.constantsService(), messagingService); -authService.init(); + +if (backgroundServices.i18n2Service()) { + authService.init(); +} export default angular .module('bit.services', ['toastr']) diff --git a/src/popup/app/services/state.service.ts b/src/popup/app/services/state.service.ts index c9a6d16a73..76baa2d5d4 100644 --- a/src/popup/app/services/state.service.ts +++ b/src/popup/app/services/state.service.ts @@ -9,8 +9,10 @@ export class StateService { } async init() { - const iconsDisabled = await this.storageService.get(this.constantsService.disableFaviconKey); - this.saveState('faviconEnabled', !iconsDisabled); + if (this.storageService != null) { + const iconsDisabled = await this.storageService.get(this.constantsService.disableFaviconKey); + this.saveState('faviconEnabled', !iconsDisabled); + } } saveState(key: string, data: any) {