1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

finish autofill from view, other misc cleanup (#1368)

* finish autofill from view, other misc cleanup

* compare hostnames for authResult
This commit is contained in:
Kyle Spearrin
2020-08-24 10:17:15 -04:00
committed by GitHub
parent d4d5ccc4a4
commit b7c2c76230
12 changed files with 150 additions and 140 deletions

View File

@@ -219,8 +219,8 @@ 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.systemService, this.vaultTimeoutService, this.syncService,
this.authService, this.stateService, this.environmentService, this.popupUtilsService);
this.analytics, this.notificationsService, this.systemService, this.vaultTimeoutService,
this.environmentService);
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
this.platformUtilsService, this.analytics, this.vaultTimeoutService);

View File

@@ -38,8 +38,7 @@ export default class RuntimeBackground {
private storageService: StorageService, private i18nService: I18nService,
private analytics: Analytics, private notificationsService: NotificationsService,
private systemService: SystemService, private vaultTimeoutService: VaultTimeoutService,
private syncService: SyncService, private authService: AuthService, private stateService: StateService,
private environmentService: EnvironmentService, private popupUtilsService : PopupUtilsService) {
private environmentService: EnvironmentService) {
this.isSafari = this.platformUtilsService.isSafari();
this.runtime = this.isSafari ? {} : chrome.runtime;
@@ -165,25 +164,21 @@ export default class RuntimeBackground {
}
break;
case 'authResult':
var vaultUrl = this.environmentService.webVaultUrl;
if(!vaultUrl) {
vaultUrl = 'https://vault.bitwarden.com';
}
let vaultUrl = this.environmentService.webVaultUrl;
if (vaultUrl == null) {
vaultUrl = 'https://vault.bitwarden.com';
}
if(!msg.referrer) {
return;
}
if(!vaultUrl.includes(msg.referrer)) {
return;
}
try {
chrome.tabs.create({
url: 'popup/index.html?uilocation=popout#/sso?code=' + msg.code + '&state=' + msg.state
});
}
catch { }
if (msg.referrer == null || Utils.getHostname(vaultUrl) !== msg.referrer) {
return;
}
try {
chrome.tabs.create({
url: 'popup/index.html?uilocation=popout#/sso?code=' + msg.code + '&state=' + msg.state
});
}
catch { }
break;
default:
break;

View File

@@ -14,6 +14,8 @@ export default class TabsBackground {
this.tabs.onActivated.addListener(async (activeInfo: any) => {
await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('tabActivated');
this.main.messagingService.send('tabChanged');
});
this.tabs.onReplaced.addListener(async (addedTabId: any, removedTabId: any) => {
@@ -23,6 +25,8 @@ export default class TabsBackground {
this.main.onReplacedRan = true;
await this.main.checkNotificationQueue();
await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('tabReplaced');
this.main.messagingService.send('tabChanged');
});
this.tabs.onUpdated.addListener(async (tabId: any, changeInfo: any, tab: any) => {
@@ -32,6 +36,8 @@ export default class TabsBackground {
this.main.onUpdatedRan = true;
await this.main.checkNotificationQueue();
await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('tabUpdated');
this.main.messagingService.send('tabChanged');
});
}
}

View File

@@ -18,6 +18,8 @@ export default class WindowsBackground {
}
await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('windowFocused');
this.main.messagingService.send('windowChanged');
});
}
}