From 9792a7ade571988ee3f11e90c5495d0bfe3da8f7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 25 Feb 2019 16:19:19 -0500 Subject: [PATCH] reload process on lock --- jslib | 2 +- src/background/main.background.ts | 7 ++++++- src/background/runtime.background.ts | 8 +++++--- src/popup/app.component.ts | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/jslib b/jslib index d0a0da8ee9e..79c15a18414 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit d0a0da8ee9ec4869001be96bc362e537ae15f961 +Subproject commit 79c15a18414190ffce39a126ccc9078405287693 diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 46243b36cd2..7fd358a1681 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -149,6 +149,10 @@ export default class MainBackground { } await this.setIcon(); await this.refreshBadgeAndMenu(true); + this.lockService.startLockReload(); + }, () => { + window.location.reload(true); + return Promise.resolve(); }); this.syncService = new SyncService(this.userService, this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, @@ -174,7 +178,7 @@ export default class MainBackground { // Background this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService, this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService, - this.analytics, this.notificationsService); + this.analytics, this.notificationsService, this.lockService); this.tabsBackground = new TabsBackground(this, this.platformUtilsService); this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService, this.platformUtilsService, this.analytics); @@ -284,6 +288,7 @@ export default class MainBackground { await this.refreshBadgeAndMenu(); await this.reseedStorage(); this.notificationsService.updateConnection(false); + this.lockService.startLockReload(); } collectPageDetailsForContentScript(tab: any, sender: string, frameId: number = null) { diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 00afb66ad41..588df0f3973 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -12,6 +12,7 @@ import { Analytics } from 'jslib/misc'; import { CipherService, + LockService, StorageService, } from 'jslib/abstractions'; @@ -36,7 +37,8 @@ export default class RuntimeBackground { constructor(private main: MainBackground, private autofillService: AutofillService, private cipherService: CipherService, private platformUtilsService: BrowserPlatformUtilsService, private storageService: StorageService, private i18nService: I18nService, - private analytics: Analytics, private notificationsService: NotificationsService) { + private analytics: Analytics, private notificationsService: NotificationsService, + private lockService: LockService) { this.isSafari = this.platformUtilsService.isSafari(); this.runtime = this.isSafari ? safari.application : chrome.runtime; @@ -81,10 +83,10 @@ export default class RuntimeBackground { switch (msg.command) { case 'loggedIn': case 'unlocked': - case 'locked': await this.main.setIcon(); - await this.main.refreshBadgeAndMenu(msg.command === 'locked'); + await this.main.refreshBadgeAndMenu(false); this.notificationsService.updateConnection(msg.command === 'unlocked'); + this.lockService.cancelLockReload(); break; case 'logout': await this.main.logout(msg.expired); diff --git a/src/popup/app.component.ts b/src/popup/app.component.ts index eedb0637313..c80d0bd4428 100644 --- a/src/popup/app.component.ts +++ b/src/popup/app.component.ts @@ -112,7 +112,9 @@ export class AppComponent implements OnInit { action: msg.action, properties: { label: msg.label }, }); - } else { + } else if (msg.command === 'reloadProcess') { + window.location.reload(true); + } else { msg.webExtSender = sender; this.broadcasterService.send(msg); }