1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-03 08:49:50 +01:00

fix null refs when no background (ff private mode)

This commit is contained in:
Kyle Spearrin 2018-03-27 12:51:07 -04:00
parent 6b42c1a16d
commit 72cb2772a6
3 changed files with 18 additions and 10 deletions

View File

@ -33,13 +33,16 @@ import { U2f } from '../../scripts/u2f';
window.U2f = U2f; window.U2f = U2f;
import { Analytics } from '../../../jslib/src/misc/analytics'; import { Analytics } from '../../../jslib/src/misc/analytics';
new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => {
const bgPage = BrowserApi.getBackgroundPage(); if (BrowserApi.getBackgroundPage()) {
if (!bgPage || !bgPage.bitwardenMain) { new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => {
throw 'Cannot resolve background page main.'; const bgPage = BrowserApi.getBackgroundPage();
} if (!bgPage || !bgPage.bitwardenMain) {
return bgPage.bitwardenMain; throw 'Cannot resolve background page main.';
}); }
return bgPage.bitwardenMain;
});
}
// Model imports // Model imports
import { Attachment } from '../../../jslib/src/models/domain/attachment'; import { Attachment } from '../../../jslib/src/models/domain/attachment';

View File

@ -13,7 +13,10 @@ const authService = new AuthService(backgroundServices.cryptoService(), backgrou
backgroundServices.userService(), backgroundServices.tokenService(), backgroundServices.appIdService(), backgroundServices.userService(), backgroundServices.tokenService(), backgroundServices.appIdService(),
backgroundServices.i18n2Service(), backgroundServices.platformUtilsService(), backgroundServices.i18n2Service(), backgroundServices.platformUtilsService(),
backgroundServices.constantsService(), messagingService); backgroundServices.constantsService(), messagingService);
authService.init();
if (backgroundServices.i18n2Service()) {
authService.init();
}
export default angular export default angular
.module('bit.services', ['toastr']) .module('bit.services', ['toastr'])

View File

@ -9,8 +9,10 @@ export class StateService {
} }
async init() { async init() {
const iconsDisabled = await this.storageService.get<boolean>(this.constantsService.disableFaviconKey); if (this.storageService != null) {
this.saveState('faviconEnabled', !iconsDisabled); const iconsDisabled = await this.storageService.get<boolean>(this.constantsService.disableFaviconKey);
this.saveState('faviconEnabled', !iconsDisabled);
}
} }
saveState(key: string, data: any) { saveState(key: string, data: any) {