mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
window reload if there is a sidebar, resolves #900
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 2ef1b7d65c...0b0245b90f
@@ -179,7 +179,9 @@ export default class MainBackground {
|
|||||||
this.storageService, this.appIdService);
|
this.storageService, this.appIdService);
|
||||||
this.systemService = new SystemService(this.storageService, this.lockService,
|
this.systemService = new SystemService(this.storageService, this.lockService,
|
||||||
this.messagingService, this.platformUtilsService, () => {
|
this.messagingService, this.platformUtilsService, () => {
|
||||||
BrowserApi.reloadExtension(window, false);
|
const forceWindowReload = this.platformUtilsService.isSafari() ||
|
||||||
|
this.platformUtilsService.isFirefox() || this.platformUtilsService.isOpera();
|
||||||
|
BrowserApi.reloadExtension(forceWindowReload ? window : null);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -288,10 +288,10 @@ export class BrowserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static reloadExtension(win: Window, popupWindow: boolean) {
|
static reloadExtension(win: Window) {
|
||||||
if (BrowserApi.isSafariApi) {
|
if (win != null) {
|
||||||
return win.location.reload(true);
|
return win.location.reload(true);
|
||||||
} else if (!popupWindow) {
|
} else if (!BrowserApi.isSafariApi) {
|
||||||
return chrome.runtime.reload();
|
return chrome.runtime.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
|||||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib/abstractions/state.service';
|
import { StateService } from 'jslib/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ export class AppComponent implements OnInit {
|
|||||||
private i18nService: I18nService, private router: Router,
|
private i18nService: I18nService, private router: Router,
|
||||||
private stateService: StateService, private messagingService: MessagingService,
|
private stateService: StateService, private messagingService: MessagingService,
|
||||||
private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone,
|
private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone,
|
||||||
private sanitizer: DomSanitizer) { }
|
private sanitizer: DomSanitizer, private platformUtilsService: PlatformUtilsService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (BrowserApi.getBackgroundPage() == null) {
|
if (BrowserApi.getBackgroundPage() == null) {
|
||||||
@@ -116,8 +117,12 @@ export class AppComponent implements OnInit {
|
|||||||
properties: { label: msg.label },
|
properties: { label: msg.label },
|
||||||
});
|
});
|
||||||
} else if (msg.command === 'reloadProcess') {
|
} else if (msg.command === 'reloadProcess') {
|
||||||
// Wait to make sure background has reloaded first.
|
const windowReload = this.platformUtilsService.isSafari() ||
|
||||||
window.setTimeout(() => BrowserApi.reloadExtension(window, true), 2000);
|
this.platformUtilsService.isFirefox() || this.platformUtilsService.isOpera();
|
||||||
|
if (windowReload) {
|
||||||
|
// Wait to make sure background has reloaded first.
|
||||||
|
window.setTimeout(() => BrowserApi.reloadExtension(window), 2000);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
msg.webExtSender = sender;
|
msg.webExtSender = sender;
|
||||||
this.broadcasterService.send(msg);
|
this.broadcasterService.send(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user