mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 23:03:32 +00:00
reload window popup when opened on safari
This commit is contained in:
@@ -162,11 +162,11 @@ export default class MainBackground {
|
|||||||
await new Analytics(window).init();
|
await new Analytics(window).init();
|
||||||
this.containerService.attachToWindow(window);
|
this.containerService.attachToWindow(window);
|
||||||
|
|
||||||
|
await this.runtimeBackground.init();
|
||||||
if (!this.isSafari) {
|
if (!this.isSafari) {
|
||||||
await this.commandsBackground.init();
|
await this.commandsBackground.init();
|
||||||
await this.contextMenusBackground.init();
|
await this.contextMenusBackground.init();
|
||||||
await this.idleBackground.init();
|
await this.idleBackground.init();
|
||||||
await this.runtimeBackground.init();
|
|
||||||
await this.tabsBackground.init();
|
await this.tabsBackground.init();
|
||||||
await this.webRequestBackground.init();
|
await this.webRequestBackground.init();
|
||||||
await this.windowsBackground.init();
|
await this.windowsBackground.init();
|
||||||
|
|||||||
@@ -17,10 +17,12 @@ export default class RuntimeBackground {
|
|||||||
private runtime: any;
|
private runtime: any;
|
||||||
private autofillTimeout: number;
|
private autofillTimeout: number;
|
||||||
private pageDetailsToAutoFill: any[] = [];
|
private pageDetailsToAutoFill: any[] = [];
|
||||||
|
private isSafari: boolean;
|
||||||
|
|
||||||
constructor(private main: MainBackground, private autofillService: AutofillService,
|
constructor(private main: MainBackground, private autofillService: AutofillService,
|
||||||
private cipherService: CipherService, private platformUtilsService: PlatformUtilsService) {
|
private cipherService: CipherService, private platformUtilsService: PlatformUtilsService) {
|
||||||
this.runtime = chrome.runtime;
|
this.isSafari = this.platformUtilsService.isSafari();
|
||||||
|
this.runtime = this.isSafari ? safari.application : chrome.runtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
@@ -28,6 +30,22 @@ export default class RuntimeBackground {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isSafari) {
|
||||||
|
// Reload the popup when it's opened
|
||||||
|
this.runtime.addEventListener('popover', (event: any) => {
|
||||||
|
const win: Window = event.target.contentWindow;
|
||||||
|
const body = win.document.body;
|
||||||
|
let child: Node = body.firstChild;
|
||||||
|
while (child) {
|
||||||
|
body.removeChild(child);
|
||||||
|
child = body.firstChild;
|
||||||
|
}
|
||||||
|
win.location.reload();
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.runtime.onInstalled) {
|
if (this.runtime.onInstalled) {
|
||||||
this.runtime.onInstalled.addListener((details: any) => {
|
this.runtime.onInstalled.addListener((details: any) => {
|
||||||
(window as any).ga('send', {
|
(window as any).ga('send', {
|
||||||
|
|||||||
Reference in New Issue
Block a user