diff --git a/jslib b/jslib index a20e935268..f09fb69882 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit a20e935268c986538ff68f72016bb8c772ea3a1b +Subproject commit f09fb69882525b3be7b2e257e7723eeb79b343d1 diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 486ef98b3c..e18837ba30 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -184,7 +184,8 @@ export default class MainBackground { this.settingsService = new SettingsService(this.userService, this.storageService); this.fileUploadService = new FileUploadService(this.logService, this.apiService); this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService, - this.apiService, this.fileUploadService, this.storageService, this.i18nService, () => this.searchService); + this.apiService, this.fileUploadService, this.storageService, this.i18nService, () => this.searchService, + this.logService); this.folderService = new FolderService(this.cryptoService, this.userService, this.apiService, this.storageService, this.i18nService, this.cipherService); this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService, @@ -193,7 +194,7 @@ export default class MainBackground { this.sendService = new SendService(this.cryptoService, this.userService, this.apiService, this.fileUploadService, this.storageService, this.i18nService, this.cryptoFunctionService); this.stateService = new StateService(); - this.policyService = new PolicyService(this.userService, this.storageService); + this.policyService = new PolicyService(this.userService, this.storageService, this.apiService); this.vaultTimeoutService = new VaultTimeoutService(this.cipherService, this.folderService, this.collectionService, this.cryptoService, this.platformUtilsService, this.storageService, this.messagingService, this.searchService, this.userService, this.tokenService, this.policyService, @@ -211,14 +212,14 @@ export default class MainBackground { this.syncService = new SyncService(this.userService, this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, this.storageService, this.messagingService, this.policyService, this.sendService, - async (expired: boolean) => await this.logout(expired)); + this.logService, async (expired: boolean) => await this.logout(expired)); this.eventService = new EventService(this.storageService, this.apiService, this.userService, - this.cipherService); + this.cipherService, this.logService); this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService, this.policyService); - this.totpService = new TotpService(this.storageService, this.cryptoFunctionService); + this.totpService = new TotpService(this.storageService, this.cryptoFunctionService, this.logService); this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService, - this.eventService); + this.eventService, this.logService); this.containerService = new ContainerService(this.cryptoService); this.auditService = new AuditService(this.cryptoFunctionService, this.apiService); this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService, @@ -242,7 +243,8 @@ export default class MainBackground { // Background this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService, - this.notificationsService, this.systemService, this.environmentService, this.messagingService); + this.notificationsService, this.systemService, this.environmentService, this.messagingService, + this.logService); this.nativeMessagingBackground = new NativeMessagingBackground(this.storageService, this.cryptoService, this.cryptoFunctionService, this.vaultTimeoutService, this.runtimeBackground, this.i18nService, this.userService, this.messagingService, this.appIdService, this.platformUtilsService); @@ -548,7 +550,9 @@ export default class MainBackground { this.browserActionSetBadgeText(theText, tabId); return; - } catch { } + } catch (e) { + this.logService.error(e); + } } await this.loadMenuAndUpdateBadgeForNoAccessState(contextMenuEnabled); diff --git a/src/background/models/addChangePasswordQueueMessage.ts b/src/background/models/addChangePasswordQueueMessage.ts index 9adcc3d5e7..65309ce7cd 100644 --- a/src/background/models/addChangePasswordQueueMessage.ts +++ b/src/background/models/addChangePasswordQueueMessage.ts @@ -1,4 +1,4 @@ -import NotificationQueueMessage from "./notificationQueueMessage"; +import NotificationQueueMessage from './notificationQueueMessage'; export default class AddChangePasswordQueueMessage extends NotificationQueueMessage { cipherId: string; diff --git a/src/background/models/addLoginQueueMessage.ts b/src/background/models/addLoginQueueMessage.ts index 466c5c6c95..1de8b721d2 100644 --- a/src/background/models/addLoginQueueMessage.ts +++ b/src/background/models/addLoginQueueMessage.ts @@ -1,4 +1,4 @@ -import NotificationQueueMessage from "./notificationQueueMessage"; +import NotificationQueueMessage from './notificationQueueMessage'; export default class AddLoginQueueMessage extends NotificationQueueMessage { username: string; diff --git a/src/background/models/lockedVaultPendingNotificationsItem.ts b/src/background/models/lockedVaultPendingNotificationsItem.ts index dec2313966..248868e6ac 100644 --- a/src/background/models/lockedVaultPendingNotificationsItem.ts +++ b/src/background/models/lockedVaultPendingNotificationsItem.ts @@ -2,6 +2,6 @@ export default class LockedVaultPendingNotificationsItem { commandToRetry: { msg: any; sender: chrome.runtime.MessageSender; - } + }; target: string; } diff --git a/src/background/models/notificationQueueMessage.ts b/src/background/models/notificationQueueMessage.ts index 1e4b81c9c9..00a05d15a4 100644 --- a/src/background/models/notificationQueueMessage.ts +++ b/src/background/models/notificationQueueMessage.ts @@ -1,4 +1,4 @@ -import { NotificationQueueMessageType } from "./notificationQueueMessageType"; +import { NotificationQueueMessageType } from './notificationQueueMessageType'; export default class NotificationQueueMessage { type: NotificationQueueMessageType; diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 71dbe6ec9d..be8441ea52 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -1,10 +1,12 @@ import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { NotificationsService } from 'jslib-common/abstractions/notifications.service'; import { StorageService } from 'jslib-common/abstractions/storage.service'; import { SystemService } from 'jslib-common/abstractions/system.service'; import { ConstantsService } from 'jslib-common/services/constants.service'; + import { AutofillService } from '../services/abstractions/autofill.service'; import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service'; @@ -25,7 +27,8 @@ export default class RuntimeBackground { private platformUtilsService: BrowserPlatformUtilsService, private storageService: StorageService, private i18nService: I18nService, private notificationsService: NotificationsService, private systemService: SystemService, - private environmentService: EnvironmentService, private messagingService: MessagingService) { + private environmentService: EnvironmentService, private messagingService: MessagingService, + private logService: LogService) { // onInstalled listener must be wired up before anything else, so we do it in the ctor chrome.runtime.onInstalled.addListener((details: any) => { @@ -137,7 +140,9 @@ export default class RuntimeBackground { BrowserApi.createNewTab('popup/index.html?uilocation=popout#/sso?code=' + msg.code + '&state=' + msg.state); } - catch { } + catch { + this.logService.error('Unable to open sso popout tab'); + } break; case 'webAuthnResult': const vaultUrl2 = this.environmentService.getWebVaultUrl(); diff --git a/src/content/notificationBar.ts b/src/content/notificationBar.ts index b973f6f52e..84964f6f62 100644 --- a/src/content/notificationBar.ts +++ b/src/content/notificationBar.ts @@ -259,7 +259,9 @@ document.addEventListener('DOMContentLoaded', event => { if (fieldData.htmlID != null && fieldData.htmlID !== '') { try { el = form.querySelector('#' + fieldData.htmlID); - } catch { } + } catch { + // Ignore error, we perform fallbacks below. + } } if (el == null && fieldData.htmlName != null && fieldData.htmlName !== '') { el = form.querySelector('input[name="' + fieldData.htmlName + '"]'); diff --git a/src/popup/accounts/hint.component.ts b/src/popup/accounts/hint.component.ts index 144b3fd4ff..d4bf83da0f 100644 --- a/src/popup/accounts/hint.component.ts +++ b/src/popup/accounts/hint.component.ts @@ -3,6 +3,7 @@ import { Router } from '@angular/router'; import { ApiService } from 'jslib-common/abstractions/api.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { HintComponent as BaseHintComponent } from 'jslib-angular/components/hint.component'; @@ -13,7 +14,7 @@ import { HintComponent as BaseHintComponent } from 'jslib-angular/components/hin }) export class HintComponent extends BaseHintComponent { constructor(router: Router, platformUtilsService: PlatformUtilsService, - i18nService: I18nService, apiService: ApiService) { - super(router, i18nService, apiService, platformUtilsService); + i18nService: I18nService, apiService: ApiService, logService: LogService) { + super(router, i18nService, apiService, platformUtilsService, logService); } } diff --git a/src/popup/accounts/lock.component.ts b/src/popup/accounts/lock.component.ts index 684dfc672a..09c9bd22fd 100644 --- a/src/popup/accounts/lock.component.ts +++ b/src/popup/accounts/lock.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { Router } from '@angular/router'; +import Swal from 'sweetalert2'; import { ConstantsService } from 'jslib-common/services/constants.service'; @@ -7,6 +8,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service'; import { CryptoService } from 'jslib-common/abstractions/crypto.service'; import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { StateService } from 'jslib-common/abstractions/state.service'; @@ -15,7 +17,6 @@ import { UserService } from 'jslib-common/abstractions/user.service'; import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service'; import { LockComponent as BaseLockComponent } from 'jslib-angular/components/lock.component'; -import Swal from 'sweetalert2'; @Component({ selector: 'app-lock', @@ -29,9 +30,9 @@ export class LockComponent extends BaseLockComponent { userService: UserService, cryptoService: CryptoService, storageService: StorageService, vaultTimeoutService: VaultTimeoutService, environmentService: EnvironmentService, stateService: StateService, - apiService: ApiService) { + apiService: ApiService, logService: LogService) { super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService, - storageService, vaultTimeoutService, environmentService, stateService, apiService); + storageService, vaultTimeoutService, environmentService, stateService, apiService, logService); this.successRoute = '/tabs/current'; this.isInitialLockScreen = (window as any).previousPopupUrl == null; } diff --git a/src/popup/accounts/login.component.ts b/src/popup/accounts/login.component.ts index 08edd398de..460666e573 100644 --- a/src/popup/accounts/login.component.ts +++ b/src/popup/accounts/login.component.ts @@ -5,6 +5,7 @@ import { AuthService } from 'jslib-common/abstractions/auth.service'; import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service'; import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { StateService } from 'jslib-common/abstractions/state.service'; @@ -23,8 +24,9 @@ export class LoginComponent extends BaseLoginComponent { protected stateService: StateService, protected environmentService: EnvironmentService, protected passwordGenerationService: PasswordGenerationService, protected cryptoFunctionService: CryptoFunctionService, storageService: StorageService, - syncService: SyncService) { - super(authService, router, platformUtilsService, i18nService, stateService, environmentService, passwordGenerationService, cryptoFunctionService, storageService); + syncService: SyncService, logService: LogService) { + super(authService, router, platformUtilsService, i18nService, stateService, environmentService, + passwordGenerationService, cryptoFunctionService, storageService, logService); super.onSuccessfulLogin = async () => { await syncService.fullSync(true); }; diff --git a/src/popup/accounts/register.component.ts b/src/popup/accounts/register.component.ts index 75fbdca157..4428b5fd9d 100644 --- a/src/popup/accounts/register.component.ts +++ b/src/popup/accounts/register.component.ts @@ -11,6 +11,7 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { StateService } from 'jslib-common/abstractions/state.service'; import { RegisterComponent as BaseRegisterComponent } from 'jslib-angular/components/register.component'; +import { LogService } from 'jslib-common/abstractions/log.service'; @Component({ selector: 'app-register', @@ -20,8 +21,9 @@ export class RegisterComponent extends BaseRegisterComponent { constructor(authService: AuthService, router: Router, i18nService: I18nService, cryptoService: CryptoService, apiService: ApiService, stateService: StateService, platformUtilsService: PlatformUtilsService, - passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService) { + passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService, + logService: LogService) { super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService, - passwordGenerationService, environmentService); + passwordGenerationService, environmentService, logService); } } diff --git a/src/popup/accounts/sso.component.ts b/src/popup/accounts/sso.component.ts index 34b3a77c01..1ee79a0aae 100644 --- a/src/popup/accounts/sso.component.ts +++ b/src/popup/accounts/sso.component.ts @@ -10,6 +10,7 @@ import { AuthService } from 'jslib-common/abstractions/auth.service'; import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service'; import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { StateService } from 'jslib-common/abstractions/state.service'; @@ -29,9 +30,9 @@ export class SsoComponent extends BaseSsoComponent { storageService: StorageService, stateService: StateService, platformUtilsService: PlatformUtilsService, apiService: ApiService, cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService, - syncService: SyncService, environmentService: EnvironmentService) { + syncService: SyncService, environmentService: EnvironmentService, logService: LogService) { super(authService, router, i18nService, route, storageService, stateService, platformUtilsService, - apiService, cryptoFunctionService, environmentService, passwordGenerationService); + apiService, cryptoFunctionService, environmentService, passwordGenerationService, logService); const url = this.environmentService.getWebVaultUrl(); diff --git a/src/popup/accounts/two-factor.component.ts b/src/popup/accounts/two-factor.component.ts index ac5e3fbb1b..9d4ed31538 100644 --- a/src/popup/accounts/two-factor.component.ts +++ b/src/popup/accounts/two-factor.component.ts @@ -1,14 +1,8 @@ -import { - ChangeDetectorRef, - Component, - NgZone, -} from '@angular/core'; - +import { Component } from '@angular/core'; import { ActivatedRoute, Router, } from '@angular/router'; - import { first } from 'rxjs/operators'; import { TwoFactorProviderType } from 'jslib-common/enums/twoFactorProviderType'; @@ -17,6 +11,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service'; import { AuthService } from 'jslib-common/abstractions/auth.service'; import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { StateService } from 'jslib-common/abstractions/state.service'; @@ -43,12 +38,12 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { constructor(authService: AuthService, router: Router, i18nService: I18nService, apiService: ApiService, platformUtilsService: PlatformUtilsService, private syncService: SyncService, - environmentService: EnvironmentService, private ngZone: NgZone, - private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef, + environmentService: EnvironmentService, private broadcasterService: BroadcasterService, private popupUtilsService: PopupUtilsService, stateService: StateService, - storageService: StorageService, route: ActivatedRoute, private messagingService: MessagingService) { + storageService: StorageService, route: ActivatedRoute, private messagingService: MessagingService, + logService: LogService) { super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService, - stateService, storageService, route); + stateService, storageService, route, logService); super.onSuccessfulLogin = () => { return syncService.fullSync(true); }; diff --git a/src/popup/accounts/update-temp-password.component.ts b/src/popup/accounts/update-temp-password.component.ts index caf867c60e..b473be0aae 100644 --- a/src/popup/accounts/update-temp-password.component.ts +++ b/src/popup/accounts/update-temp-password.component.ts @@ -3,6 +3,7 @@ import { Component } from '@angular/core'; import { ApiService } from 'jslib-common/abstractions/api.service'; import { CryptoService } from 'jslib-common/abstractions/crypto.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; @@ -57,8 +58,8 @@ export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent passwordGenerationService: PasswordGenerationService, policyService: PolicyService, cryptoService: CryptoService, userService: UserService, messagingService: MessagingService, apiService: ApiService, - syncService: SyncService) { + syncService: SyncService, logService: LogService) { super(i18nService, platformUtilsService, passwordGenerationService, policyService, cryptoService, - userService, messagingService, apiService, syncService); + userService, messagingService, apiService, syncService, logService); } } diff --git a/src/popup/send/send-add-edit.component.ts b/src/popup/send/send-add-edit.component.ts index 6f10a510b9..def91594b0 100644 --- a/src/popup/send/send-add-edit.component.ts +++ b/src/popup/send/send-add-edit.component.ts @@ -14,11 +14,11 @@ import { first } from 'rxjs/operators'; import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { PolicyService } from 'jslib-common/abstractions/policy.service'; import { SendService } from 'jslib-common/abstractions/send.service'; -import { TokenService } from 'jslib-common/abstractions/token.service'; import { UserService } from 'jslib-common/abstractions/user.service'; import { PopupUtilsService } from '../services/popup-utils.service'; @@ -43,9 +43,9 @@ export class SendAddEditComponent extends BaseAddEditComponent { userService: UserService, messagingService: MessagingService, policyService: PolicyService, environmentService: EnvironmentService, datePipe: DatePipe, sendService: SendService, private route: ActivatedRoute, private router: Router, private location: Location, - private popupUtilsService: PopupUtilsService) { + private popupUtilsService: PopupUtilsService, logService: LogService) { super(i18nService, platformUtilsService, environmentService, datePipe, sendService, userService, - messagingService, policyService); + messagingService, policyService, logService); } get showFileSelector(): boolean { diff --git a/src/popup/send/send-groupings.component.ts b/src/popup/send/send-groupings.component.ts index 2704dc4554..f4f8f47a29 100644 --- a/src/popup/send/send-groupings.component.ts +++ b/src/popup/send/send-groupings.component.ts @@ -14,6 +14,7 @@ import { SendComponent as BaseSendComponent } from 'jslib-angular/components/sen import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { PolicyService } from 'jslib-common/abstractions/policy.service'; import { SearchService } from 'jslib-common/abstractions/search.service'; @@ -50,9 +51,10 @@ export class SendGroupingsComponent extends BaseSendComponent { policyService: PolicyService, userService: UserService, searchService: SearchService, private popupUtils: PopupUtilsService, private stateService: StateService, private router: Router, private syncService: SyncService, - private changeDetectorRef: ChangeDetectorRef, private broadcasterService: BroadcasterService) { + private changeDetectorRef: ChangeDetectorRef, private broadcasterService: BroadcasterService, + logService: LogService) { super(sendService, i18nService, platformUtilsService, environmentService, ngZone, searchService, - policyService, userService); + policyService, userService, logService); super.onSuccessfulLoad = async () => { this.calculateTypeCounts(); this.selectAll(); diff --git a/src/popup/send/send-type.component.ts b/src/popup/send/send-type.component.ts index bf143d2f11..0b26f31d2f 100644 --- a/src/popup/send/send-type.component.ts +++ b/src/popup/send/send-type.component.ts @@ -19,6 +19,7 @@ import { SendComponent as BaseSendComponent } from 'jslib-angular/components/sen import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { PolicyService } from 'jslib-common/abstractions/policy.service'; import { SearchService } from 'jslib-common/abstractions/search.service'; @@ -50,9 +51,9 @@ export class SendTypeComponent extends BaseSendComponent { policyService: PolicyService, userService: UserService, searchService: SearchService, private popupUtils: PopupUtilsService, private stateService: StateService, private route: ActivatedRoute, private location: Location, private changeDetectorRef: ChangeDetectorRef, - private broadcasterService: BroadcasterService, private router: Router) { + private broadcasterService: BroadcasterService, private router: Router, logService: LogService) { super(sendService, i18nService, platformUtilsService, environmentService, ngZone, searchService, - policyService, userService); + policyService, userService, logService); super.onSuccessfulLoad = async () => { this.selectType(this.type); }; diff --git a/src/popup/settings/export.component.ts b/src/popup/settings/export.component.ts index 67a5f804a9..ad936f0f05 100644 --- a/src/popup/settings/export.component.ts +++ b/src/popup/settings/export.component.ts @@ -5,6 +5,7 @@ import { CryptoService } from 'jslib-common/abstractions/crypto.service'; import { EventService } from 'jslib-common/abstractions/event.service'; import { ExportService } from 'jslib-common/abstractions/export.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { PolicyService } from 'jslib-common/abstractions/policy.service'; @@ -17,8 +18,10 @@ import { ExportComponent as BaseExportComponent } from 'jslib-angular/components export class ExportComponent extends BaseExportComponent { constructor(cryptoService: CryptoService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, exportService: ExportService, - eventService: EventService, policyService: PolicyService, private router: Router) { - super(cryptoService, i18nService, platformUtilsService, exportService, eventService, policyService, window); + eventService: EventService, policyService: PolicyService, private router: Router, + logService: LogService) { + super(cryptoService, i18nService, platformUtilsService, exportService, eventService, policyService, window, + logService); } protected saved() { diff --git a/src/popup/settings/folder-add-edit.component.ts b/src/popup/settings/folder-add-edit.component.ts index ef501ba301..41be9f21d5 100644 --- a/src/popup/settings/folder-add-edit.component.ts +++ b/src/popup/settings/folder-add-edit.component.ts @@ -8,6 +8,7 @@ import { first } from 'rxjs/operators'; import { FolderService } from 'jslib-common/abstractions/folder.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { @@ -21,8 +22,8 @@ import { export class FolderAddEditComponent extends BaseFolderAddEditComponent { constructor(folderService: FolderService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, private router: Router, - private route: ActivatedRoute) { - super(folderService, i18nService, platformUtilsService); + private route: ActivatedRoute, logService: LogService) { + super(folderService, i18nService, platformUtilsService, logService); } async ngOnInit() { diff --git a/src/popup/settings/premium.component.ts b/src/popup/settings/premium.component.ts index 4074a7e6eb..3388798a16 100644 --- a/src/popup/settings/premium.component.ts +++ b/src/popup/settings/premium.component.ts @@ -3,6 +3,7 @@ import { Component } from '@angular/core'; import { ApiService } from 'jslib-common/abstractions/api.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { UserService } from 'jslib-common/abstractions/user.service'; @@ -17,8 +18,8 @@ export class PremiumComponent extends BasePremiumComponent { constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService, apiService: ApiService, userService: UserService, - private currencyPipe: CurrencyPipe) { - super(i18nService, platformUtilsService, apiService, userService); + private currencyPipe: CurrencyPipe, logService: LogService) { + super(i18nService, platformUtilsService, apiService, userService, logService); // Support old price string. Can be removed in future once all translations are properly updated. const thePrice = this.currencyPipe.transform(this.price, '$'); diff --git a/src/popup/vault/add-edit.component.ts b/src/popup/vault/add-edit.component.ts index 841d730b7f..82379063a4 100644 --- a/src/popup/vault/add-edit.component.ts +++ b/src/popup/vault/add-edit.component.ts @@ -15,6 +15,7 @@ import { CollectionService } from 'jslib-common/abstractions/collection.service' import { EventService } from 'jslib-common/abstractions/event.service'; import { FolderService } from 'jslib-common/abstractions/folder.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { PolicyService } from 'jslib-common/abstractions/policy.service'; @@ -23,6 +24,7 @@ import { StorageService } from 'jslib-common/abstractions/storage.service'; import { UserService } from 'jslib-common/abstractions/user.service'; import { ConstantsService } from 'jslib-common/services/constants.service'; + import { PopupUtilsService } from '../services/popup-utils.service'; import { LoginUriView } from 'jslib-common/models/view/loginUriView'; @@ -48,9 +50,10 @@ export class AddEditComponent extends BaseAddEditComponent { messagingService: MessagingService, private route: ActivatedRoute, private router: Router, private location: Location, eventService: EventService, policyService: PolicyService, - private popupUtilsService: PopupUtilsService, private storageService: StorageService) { + private popupUtilsService: PopupUtilsService, private storageService: StorageService, + logService: LogService) { super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService, - userService, collectionService, messagingService, eventService, policyService); + userService, collectionService, messagingService, eventService, policyService, logService); } async ngOnInit() { diff --git a/src/popup/vault/attachments.component.ts b/src/popup/vault/attachments.component.ts index f682154374..9ef9d0547a 100644 --- a/src/popup/vault/attachments.component.ts +++ b/src/popup/vault/attachments.component.ts @@ -8,6 +8,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CryptoService } from 'jslib-common/abstractions/crypto.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { UserService } from 'jslib-common/abstractions/user.service'; @@ -23,8 +24,9 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { constructor(cipherService: CipherService, i18nService: I18nService, cryptoService: CryptoService, userService: UserService, platformUtilsService: PlatformUtilsService, apiService: ApiService, private location: Location, - private route: ActivatedRoute, private router: Router) { - super(cipherService, i18nService, cryptoService, userService, platformUtilsService, apiService, window); + private route: ActivatedRoute, logService: LogService) { + super(cipherService, i18nService, cryptoService, userService, platformUtilsService, apiService, window, + logService); } async ngOnInit() { diff --git a/src/popup/vault/collections.component.ts b/src/popup/vault/collections.component.ts index 9a7734f988..fa1fa5372c 100644 --- a/src/popup/vault/collections.component.ts +++ b/src/popup/vault/collections.component.ts @@ -1,12 +1,12 @@ import { Location } from '@angular/common'; import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; - import { first } from 'rxjs/operators'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CollectionService } from 'jslib-common/abstractions/collection.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { CollectionsComponent as BaseCollectionsComponent } from 'jslib-angular/components/collections.component'; @@ -18,8 +18,9 @@ import { CollectionsComponent as BaseCollectionsComponent } from 'jslib-angular/ export class CollectionsComponent extends BaseCollectionsComponent { constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService, i18nService: I18nService, cipherService: CipherService, - private route: ActivatedRoute, private location: Location) { - super(collectionService, platformUtilsService, i18nService, cipherService); + private route: ActivatedRoute, private location: Location, + logService: LogService) { + super(collectionService, platformUtilsService, i18nService, cipherService, logService); } async ngOnInit() { diff --git a/src/popup/vault/share.component.ts b/src/popup/vault/share.component.ts index 963eb5fda0..c32804d563 100644 --- a/src/popup/vault/share.component.ts +++ b/src/popup/vault/share.component.ts @@ -10,6 +10,7 @@ import { first } from 'rxjs/operators'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CollectionService } from 'jslib-common/abstractions/collection.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; import { UserService } from 'jslib-common/abstractions/user.service'; @@ -23,8 +24,9 @@ export class ShareComponent extends BaseShareComponent { constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService, i18nService: I18nService, userService: UserService, cipherService: CipherService, private route: ActivatedRoute, - private location: Location, private router: Router) { - super(collectionService, platformUtilsService, i18nService, userService, cipherService); + private router: Router, logService: LogService) { + super(collectionService, platformUtilsService, i18nService, userService, cipherService, + logService); } async ngOnInit() { diff --git a/src/popup/vault/view.component.ts b/src/popup/vault/view.component.ts index 8a55009538..b18a16feb8 100644 --- a/src/popup/vault/view.component.ts +++ b/src/popup/vault/view.component.ts @@ -17,6 +17,7 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CryptoService } from 'jslib-common/abstractions/crypto.service'; import { EventService } from 'jslib-common/abstractions/event.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; @@ -59,10 +60,11 @@ export class ViewComponent extends BaseViewComponent { changeDetectorRef: ChangeDetectorRef, userService: UserService, eventService: EventService, private autofillService: AutofillService, private messagingService: MessagingService, private popupUtilsService: PopupUtilsService, - apiService: ApiService, passwordRepromptService: PasswordRepromptService) { + apiService: ApiService, passwordRepromptService: PasswordRepromptService, + logService: LogService) { super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService, auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService, - apiService, passwordRepromptService); + apiService, passwordRepromptService, logService); } ngOnInit() { diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index d50813cc43..d0d09840ab 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -1,5 +1,6 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { EventService } from 'jslib-common/abstractions/event.service'; +import { LogService } from 'jslib-common/abstractions/log.service'; import { TotpService } from 'jslib-common/abstractions/totp.service'; import { UserService } from 'jslib-common/abstractions/user.service'; @@ -131,7 +132,8 @@ var IsoProvinces: { [id: string]: string; } = { export default class AutofillService implements AutofillServiceInterface { constructor(private cipherService: CipherService, private userService: UserService, - private totpService: TotpService, private eventService: EventService) { } + private totpService: TotpService, private eventService: EventService, + private logService: LogService) { } getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] { const formData: any[] = []; @@ -1079,7 +1081,9 @@ export default class AutofillService implements AutofillServiceInterface { const regex = new RegExp(regexParts[1], 'i'); return regex.test(fieldVal); } - } catch (e) { } + } catch (e) { + this.logService.error(e); + } } else if (name.startsWith('csv=')) { const csvParts = name.split('=', 2); if (csvParts.length === 2) { diff --git a/tslint.json b/tslint.json index 56dfb1f867..86fe805978 100644 --- a/tslint.json +++ b/tslint.json @@ -34,7 +34,7 @@ ] } ], - "no-empty": [ true, "allow-empty-catch" ], + "no-empty": [ true ], "object-literal-sort-keys": false, "object-literal-shorthand": [ true, "never" ], "prefer-for-of": false,