Merge pull request #4592 from vittominacori/fix/close-popup-bug-#4553

set an id to the metamask notification popup
This commit is contained in:
Thomas Huang 2018-06-20 15:50:07 -07:00 committed by GitHub
commit 46b2f1df11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -32,6 +32,8 @@ class NotificationManager {
type: 'popup', type: 'popup',
width, width,
height, height,
}).then((currentPopup) => {
this._popupId = currentPopup.id
}) })
} }
}) })
@ -84,7 +86,7 @@ class NotificationManager {
} }
/** /**
* Given an array of windows, returns the first that has a 'popup' type, or null if no such window exists. * Given an array of windows, returns the 'popup' that has been opened by MetaMask, or null if no such window exists.
* *
* @private * @private
* @param {array} windows An array of objects containing data about the open MetaMask extension windows. * @param {array} windows An array of objects containing data about the open MetaMask extension windows.
@ -93,7 +95,7 @@ class NotificationManager {
_getPopupIn (windows) { _getPopupIn (windows) {
return windows ? windows.find((win) => { return windows ? windows.find((win) => {
// Returns notification popup // Returns notification popup
return (win && win.type === 'popup') return (win && win.type === 'popup' && win.id === this._popupId)
}) : null }) : null
} }