aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorConnor Christie <christieck@msoe.edu>2018-09-10 08:33:09 +0800
committerConnor Christie <christieck@msoe.edu>2018-09-10 08:33:51 +0800
commitee568d5f5a3d04f32969fd2ba3113b9eeb175d63 (patch)
treee78e6ce4cce48a9146e513de9b6da165c9a3c921 /app
parentfdb023381be323bd3198d5e102447e6591e7e73e (diff)
downloadtangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.tar
tangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.tar.gz
tangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.tar.bz2
tangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.tar.lz
tangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.tar.xz
tangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.tar.zst
tangerine-wallet-browser-ee568d5f5a3d04f32969fd2ba3113b9eeb175d63.zip
Upgrade obs-store and fix memory leaks
Diffstat (limited to 'app')
-rw-r--r--app/scripts/metamask-controller.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 98cb62bfa..1060f508a 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -177,7 +177,7 @@ module.exports = class MetamaskController extends EventEmitter {
blockTracker: this.blockTracker,
getGasPrice: this.getGasPrice.bind(this),
})
- this.txController.on('newUnapprovedTx', opts.showUnapprovedTx.bind(opts))
+ this.txController.on('newUnapprovedTx', () => opts.showUnapprovedTx())
this.txController.on(`tx:status-update`, (txId, status) => {
if (status === 'confirmed' || status === 'failed') {
@@ -1229,8 +1229,10 @@ module.exports = class MetamaskController extends EventEmitter {
)
dnode.on('remote', (remote) => {
// push updates to popup
- const sendUpdate = remote.sendUpdate.bind(remote)
+ const sendUpdate = (update) => remote.sendUpdate(update)
this.on('update', sendUpdate)
+ // remove update listener once the connection ends
+ dnode.on('end', () => this.removeListener('update', sendUpdate))
})
}
@@ -1280,10 +1282,12 @@ module.exports = class MetamaskController extends EventEmitter {
* @param {*} outStream - The stream to provide public config over.
*/
setupPublicConfig (outStream) {
+ const configStream = asStream(this.publicConfigStore)
pump(
- asStream(this.publicConfigStore),
+ configStream,
outStream,
(err) => {
+ configStream.destroy()
if (err) log.error(err)
}
)