Merge pull request #655 from MetaMask/FixPortStreamEnd

Fix port stream end bug
feature/default_network_editable
kumavis 8 years ago committed by Dan Finlay
commit 11363b4f2a
  1. 12
      app/scripts/lib/notifications.js
  2. 3
      app/scripts/lib/port-stream.js

@ -1,4 +1,6 @@
const extension = require('./extension')
const height = 500
const width = 360
const notifications = {
show,
@ -24,8 +26,8 @@ function show () {
url: 'notification.html',
type: 'popup',
focused: true,
width: 360,
height: 500,
width,
height,
})
}
@ -51,7 +53,11 @@ function getPopup(cb) {
}
function getPopupIn(windows) {
return windows ? windows.find((win) => win.type === 'popup') : null
return windows ? windows.find((win) => {
return (win && win.type === 'popup' &&
win.height === height &&
win.width === width)
}) : null
}
function closePopup() {

@ -30,8 +30,7 @@ PortDuplexStream.prototype._onMessage = function (msg) {
PortDuplexStream.prototype._onDisconnect = function () {
try {
// this.end()
this.emit('close')
this.push(null)
} catch (err) {
this.emit('error', err)
}

Loading…
Cancel
Save