1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 19:23:52 +00:00

wait for getBackgroundPage to have a result

This commit is contained in:
Kyle Spearrin
2018-09-29 22:58:36 -04:00
parent 8425e65544
commit 2cbdb33e0f
2 changed files with 32 additions and 14 deletions

View File

@@ -14,19 +14,7 @@ export class LaunchGuardService implements CanActivate {
constructor(private cryptoService: CryptoService, private userService: UserService, private router: Router) { }
async canActivate() {
const bg = BrowserApi.getBackgroundPage();
if (bg == null) {
if (window.navigator.userAgent.indexOf(' Edge/') !== -1) {
// tslint:disable-next-line
console.log('Background page is null.');
// tslint:disable-next-line
console.log(bg);
window.setTimeout(() => {
// tslint:disable-next-line
console.log('Reload page for Edge.');
window.location.reload();
}, 1000);
}
if (BrowserApi.getBackgroundPage() == null) {
this.router.navigate(['private-mode']);
return false;
}