mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-31 17:57:43 +01:00
browser api for closing popup
This commit is contained in:
parent
c15a2f5747
commit
4fc21767be
@ -170,6 +170,14 @@ class BrowserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static closePopup(win: Window) {
|
||||||
|
if (BrowserApi.isChromeApi) {
|
||||||
|
win.close();
|
||||||
|
} else if (BrowserApi.isSafariApi && safari.extension.popovers && safari.extension.popovers.length > 0) {
|
||||||
|
safari.extension.popovers[0].hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static makeTabObject(tab: any) {
|
private static makeTabObject(tab: any) {
|
||||||
if (BrowserApi.isChromeApi) {
|
if (BrowserApi.isChromeApi) {
|
||||||
return tab;
|
return tab;
|
||||||
|
@ -27,7 +27,7 @@ export class ActionButtonsController implements ng.IController {
|
|||||||
self.$analytics.eventTrack('Launched Website From Listing');
|
self.$analytics.eventTrack('Launched Website From Listing');
|
||||||
BrowserApi.createNewTab(self.cipher.login.uri);
|
BrowserApi.createNewTab(self.cipher.login.uri);
|
||||||
if (PopupUtilsService.inPopup(self.$window)) {
|
if (PopupUtilsService.inPopup(self.$window)) {
|
||||||
self.$window.close();
|
BrowserApi.closePopup(self.$window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ export class PopOutController implements ng.IController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (PopupUtilsService.inPopup(this.$window)) {
|
if (PopupUtilsService.inPopup(this.$window)) {
|
||||||
this.$window.close();
|
BrowserApi.closePopup(this.$window);
|
||||||
}
|
}
|
||||||
} else if ((typeof chrome !== 'undefined') && chrome.tabs && chrome.tabs.create) {
|
} else if ((typeof chrome !== 'undefined') && chrome.tabs && chrome.tabs.create) {
|
||||||
href = href.replace('uilocation=popup', 'uilocation=tab')
|
href = href.replace('uilocation=popup', 'uilocation=tab')
|
||||||
|
@ -90,7 +90,7 @@ export class CurrentController {
|
|||||||
this.utilsService.copyToClipboard(totpCode, document);
|
this.utilsService.copyToClipboard(totpCode, document);
|
||||||
}
|
}
|
||||||
if (PopupUtilsService.inPopup(this.$window)) {
|
if (PopupUtilsService.inPopup(this.$window)) {
|
||||||
this.$window.close();
|
BrowserApi.closePopup(this.$window);
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$analytics.eventTrack('Autofilled Error');
|
this.$analytics.eventTrack('Autofilled Error');
|
||||||
|
Loading…
Reference in New Issue
Block a user