From 38078d7a8d098057eaa25dade017627e2143c7d7 Mon Sep 17 00:00:00 2001 From: jpatel888 <14117763+jpatel888@users.noreply.github.com> Date: Thu, 11 Feb 2021 17:07:56 -0500 Subject: [PATCH] Fix BatchRequest.execute() multiple window issue (#10423) --- app/scripts/background.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index ca7c04951..c9155c858 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -53,6 +53,7 @@ global.METAMASK_NOTIFIER = notificationManager; let popupIsOpen = false; let notificationIsOpen = false; +let uiIsTriggering = false; const openMetamaskTabsIDs = {}; const requestAccountTabIds = {}; @@ -482,8 +483,17 @@ async function triggerUi() { tabs.length > 0 && tabs[0].extData && tabs[0].extData.indexOf('vivaldi_tab') > -1; - if ((isVivaldi || !popupIsOpen) && !currentlyActiveMetamaskTab) { - await notificationManager.showPopup(); + if ( + !uiIsTriggering && + (isVivaldi || !popupIsOpen) && + !currentlyActiveMetamaskTab + ) { + uiIsTriggering = true; + try { + await notificationManager.showPopup(); + } finally { + uiIsTriggering = false; + } } }