aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/background.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-03-22 03:42:03 +0800
committerGitHub <noreply@github.com>2018-03-22 03:42:03 +0800
commit278e1ba61eab97860be295ad938cf47ce22f11ed (patch)
tree0d1f23170865e44409c8ee552ec41c993044a4ab /app/scripts/background.js
parenta80be4c8c37464ec6b5071482756f0cb7532924c (diff)
parent1343f5ede466c4fd8057795478ad21d0382d73cb (diff)
downloadtangerine-wallet-browser-278e1ba61eab97860be295ad938cf47ce22f11ed.tar.gz
tangerine-wallet-browser-278e1ba61eab97860be295ad938cf47ce22f11ed.tar.zst
tangerine-wallet-browser-278e1ba61eab97860be295ad938cf47ce22f11ed.zip
Merge pull request #3656 from MetaMask/trigun0x2-master2
Prevent batch request from opening multiple windows (3)
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r--app/scripts/background.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index ef5513ec7..8bd7766ad 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -42,6 +42,7 @@ const isIE = !!document.documentMode
const isEdge = !isIE && !!window.StyleMedia
let popupIsOpen = false
+let notificationIsOpen = false
let openMetamaskTabsIDs = {}
// state persistence
@@ -165,6 +166,11 @@ function setupController (initState) {
}
})
}
+ if (remotePort.name === 'notification') {
+ endOfStream(portStream, () => {
+ notificationIsOpen = false
+ })
+ }
} else {
// communication with page
const originDomain = urlUtil.parse(remotePort.sender.url).hostname
@@ -207,7 +213,8 @@ function setupController (initState) {
function triggerUi () {
extension.tabs.query({ active: true }, (tabs) => {
const currentlyActiveMetamaskTab = tabs.find(tab => openMetamaskTabsIDs[tab.id])
- if (!popupIsOpen && !currentlyActiveMetamaskTab) notificationManager.showPopup()
+ if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) notificationManager.showPopup()
+ notificationIsOpen = true
})
}