diff --git a/src/popup/app/accounts/accountsLoginTwoFactorController.js b/src/popup/app/accounts/accountsLoginTwoFactorController.js index 229adf83..ca497aab 100644 --- a/src/popup/app/accounts/accountsLoginTwoFactorController.js +++ b/src/popup/app/accounts/accountsLoginTwoFactorController.js @@ -175,9 +175,8 @@ params = providers[constants.twoFactorProvider.email]; $scope.twoFactorEmail = params.Email; - if (chrome.extension.getViews({ type: 'popup' }).length > 0 && - !utilsService.inSidebar($window) && - !utilsService.inTab($window)) { + if (chrome.extension.getViews({ type: 'popup' }).length > 0 && !utilsService.inSidebar($window) && + !utilsService.inTab($window) && !utilsService.inPopout($window)) { SweetAlert.swal({ title: i18nService.twoStepLogin, text: i18nService.popup2faCloseMessage, diff --git a/src/popup/app/global/mainController.js b/src/popup/app/global/mainController.js index 2a2e710b..b9dff718 100644 --- a/src/popup/app/global/mainController.js +++ b/src/popup/app/global/mainController.js @@ -33,8 +33,28 @@ angular } } - href = href.replace('uilocation=popup', 'uilocation=tab').replace('uilocation=sidebar', 'uilocation=tab'); - chrome.tabs.create({ url: href }); + if (chrome.windows.create) { + href = href.replace('uilocation=popup', 'uilocation=popout').replace('uilocation=tab', 'uilocation=popout') + .replace('uilocation=sidebar', 'uilocation=popout'); + + chrome.windows.create({ + url: href, + type: 'popup', + width: $('body').width() + 60, + height: $('body').height() + }); + + if (utilsService.inPopup($window)) { + $window.close(); + } + } + else { + href = href.replace('uilocation=popup', 'uilocation=tab').replace('uilocation=popout', 'uilocation=tab') + .replace('uilocation=sidebar', 'uilocation=tab'); + chrome.tabs.create({ + url: href + }); + } }; chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { diff --git a/src/services/utilsService.js b/src/services/utilsService.js index 58a862d9..e2004a0a 100644 --- a/src/services/utilsService.js +++ b/src/services/utilsService.js @@ -236,6 +236,10 @@ function initUtilsService() { return theWindow.location.search && theWindow.location.search.indexOf('uilocation=tab') > -1; }; + UtilsService.prototype.inPopout = function (theWindow) { + return theWindow.location.search && theWindow.location.search.indexOf('uilocation=popout') > -1; + }; + UtilsService.prototype.inPopup = function (theWindow) { return theWindow.location.search && theWindow.location.search.indexOf('uilocation=popup') > -1; };