mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
metamask controller - destroy filter polyfill on disconnect
This commit is contained in:
parent
245c0f0c27
commit
765ef64061
@ -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)
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user