aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-14 06:19:44 +0800
committerkumavis <aaron@kumavis.me>2017-09-14 06:19:44 +0800
commit765ef640610584a3fdd7fa0ef716f6c7a553407c (patch)
tree561a21fc727350e0e6c03b350fed6a078b99e721 /app
parent245c0f0c2741d1dcb706faa93ff681333a40b9c8 (diff)
downloadtangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.tar
tangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.tar.gz
tangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.tar.bz2
tangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.tar.lz
tangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.tar.xz
tangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.tar.zst
tangerine-wallet-browser-765ef640610584a3fdd7fa0ef716f6c7a553407c.zip
metamask controller - destroy filter polyfill on disconnect
Diffstat (limited to 'app')
-rw-r--r--app/scripts/metamask-controller.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index f114d22f3..fef16c3a9 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -389,12 +389,16 @@ module.exports = class MetamaskController extends EventEmitter {
setupProviderConnection (outStream, origin) {
// setup json rpc engine stack
const engine = new RpcEngine()
- engine.push(createOriginMiddleware({ origin }))
- engine.push(createLoggerMiddleware({ origin }))
- engine.push(createFilterMiddleware({
+
+ // create filter polyfill middleware
+ const filterMiddleware = createFilterMiddleware({
provider: this.provider,
blockTracker: this.blockTracker,
- }))
+ })
+
+ engine.push(createOriginMiddleware({ origin }))
+ engine.push(createLoggerMiddleware({ origin }))
+ engine.push(filterMiddleware)
engine.push(createProviderMiddleware({ provider: this.provider }))
// setup connection
@@ -404,6 +408,8 @@ module.exports = class MetamaskController extends EventEmitter {
providerStream,
outStream,
(err) => {
+ // cleanup filter polyfill middleware
+ filterMiddleware.destroy()
if (err) log.error(err)
}
)