From 62b33eee7e626b782b45b0a1a3b3a7246952f9cd Mon Sep 17 00:00:00 2001 From: Jaimish Patel Date: Thu, 11 Feb 2021 16:03:46 -0500 Subject: [PATCH 1/3] Fix BatchRequest.execute() multiple window issue --- app/scripts/background.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index ca7c049514d7..9a356473b015 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,15 @@ 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(); + } catch (err) { + log.error('Error triggering UI', err); + } finally { + uiIsTriggering = false; + } } } From e1cc872319dddd6ed25dfe31edd95477878aefbc Mon Sep 17 00:00:00 2001 From: jpatel888 <14117763+jpatel888@users.noreply.github.com> Date: Thu, 11 Feb 2021 16:21:43 -0500 Subject: [PATCH 2/3] Update app/scripts/background.js Co-authored-by: Mark Stacey --- app/scripts/background.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 9a356473b015..a049461b16be 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -487,8 +487,6 @@ async function triggerUi() { uiIsTriggering = true; try { await notificationManager.showPopup(); - } catch (err) { - log.error('Error triggering UI', err); } finally { uiIsTriggering = false; } From dc0a49b53c2d3cc8daf9034a0eaaffac98d8e34e Mon Sep 17 00:00:00 2001 From: Jaimish Patel Date: Thu, 11 Feb 2021 16:42:01 -0500 Subject: [PATCH 3/3] Fixed lint issues --- app/scripts/background.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index a049461b16be..c9155c858a4f 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -483,7 +483,11 @@ async function triggerUi() { tabs.length > 0 && tabs[0].extData && tabs[0].extData.indexOf('vivaldi_tab') > -1; - if (!uiIsTriggering && (isVivaldi || !popupIsOpen) && !currentlyActiveMetamaskTab) { + if ( + !uiIsTriggering && + (isVivaldi || !popupIsOpen) && + !currentlyActiveMetamaskTab + ) { uiIsTriggering = true; try { await notificationManager.showPopup();