aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-05-23 07:19:51 +0800
committerGitHub <noreply@github.com>2017-05-23 07:19:51 +0800
commit8520fe5afec432f45b54cbe51e6253e51dc54e89 (patch)
treeb11422d9c1b609be5f85e8240f33d170fe5cbe48
parentc7fd9f424087b20bfc356d360d2a2246ca0e5ad7 (diff)
parentb217ad1ae8109e9648da948bde06cdc88317396a (diff)
downloadtangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.tar
tangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.tar.gz
tangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.tar.bz2
tangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.tar.lz
tangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.tar.xz
tangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.tar.zst
tangerine-wallet-browser-8520fe5afec432f45b54cbe51e6253e51dc54e89.zip
Merge pull request #1474 from MetaMask/i1458-StreamingSubprovider
Fix filter polling leak
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/scripts/lib/inpage-provider.js22
-rw-r--r--package.json2
3 files changed, 20 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 371b348ca..c31f26f04 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Current Master
+- Fix bug where website filters would pile up and not deallocate when leaving a site.
+
## 3.6.5 2017-5-17
- Fix bug where edited gas parameters would not take effect.
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index e5e398e24..e54f547bd 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -1,5 +1,7 @@
const pipe = require('pump')
-const StreamProvider = require('web3-stream-provider')
+const ProviderEngine = require('web3-provider-engine')
+const FilterSubprovider = require('web3-provider-engine/subproviders/filters')
+const StreamSubprovider = require('web3-provider-engine/subproviders/stream')
const LocalStorageStore = require('obs-store')
const ObjectMultiplex = require('./obj-multiplex')
const createRandomId = require('./random-id')
@@ -27,14 +29,24 @@ function MetamaskInpageProvider (connectionStream) {
)
// connect to async provider
- const asyncProvider = self.asyncProvider = new StreamProvider()
+ const engine = new ProviderEngine()
+
+ const filterSubprovider = new FilterSubprovider()
+ engine.addProvider(filterSubprovider)
+
+ const streamSubprovider = new StreamSubprovider()
+ engine.addProvider(streamSubprovider)
+
pipe(
- asyncProvider,
+ streamSubprovider,
multiStream.createStream('provider'),
- asyncProvider,
+ streamSubprovider,
(err) => logStreamDisconnectWarning('MetaMask RpcProvider', err)
)
+ // start polling
+ engine.start()
+
self.idMap = {}
// handle sendAsync requests via asyncProvider
self.sendAsync = function (payload, cb) {
@@ -46,7 +58,7 @@ function MetamaskInpageProvider (connectionStream) {
return message
})
// forward to asyncProvider
- asyncProvider.sendAsync(request, function (err, res) {
+ engine.sendAsync(request, function (err, res) {
if (err) return cb(err)
// transform messages to original ids
eachJsonMessage(res, (message) => {
diff --git a/package.json b/package.json
index 14ddd2886..dba82d17c 100644
--- a/package.json
+++ b/package.json
@@ -121,7 +121,7 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "0.18.2",
- "web3-provider-engine": "^12.0.6",
+ "web3-provider-engine": "^12.1.0",
"web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1"
},