mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-29 17:38:04 +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) {
|
||||
if (BrowserApi.isChromeApi) {
|
||||
return tab;
|
||||
|
@ -27,7 +27,7 @@ export class ActionButtonsController implements ng.IController {
|
||||
self.$analytics.eventTrack('Launched Website From Listing');
|
||||
BrowserApi.createNewTab(self.cipher.login.uri);
|
||||
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)) {
|
||||
this.$window.close();
|
||||
BrowserApi.closePopup(this.$window);
|
||||
}
|
||||
} else if ((typeof chrome !== 'undefined') && chrome.tabs && chrome.tabs.create) {
|
||||
href = href.replace('uilocation=popup', 'uilocation=tab')
|
||||
|
@ -90,7 +90,7 @@ export class CurrentController {
|
||||
this.utilsService.copyToClipboard(totpCode, document);
|
||||
}
|
||||
if (PopupUtilsService.inPopup(this.$window)) {
|
||||
this.$window.close();
|
||||
BrowserApi.closePopup(this.$window);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$analytics.eventTrack('Autofilled Error');
|
||||
|
Loading…
Reference in New Issue
Block a user