diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-09-09 04:06:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-09 04:06:59 +0800 |
commit | 5fa0b992a754cb8ab467f3b29233692920d7e679 (patch) | |
tree | 43b7b1de67db464a4aeda6d57194cd0eea8dde83 | |
parent | a704e1d14370056a9a1a8af43c702bb00142532d (diff) | |
parent | 585a32534d9415eec9f91b19732e121a4a4c3a79 (diff) | |
download | tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.tar tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.tar.gz tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.tar.bz2 tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.tar.lz tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.tar.xz tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.tar.zst tangerine-wallet-browser-5fa0b992a754cb8ab467f3b29233692920d7e679.zip |
Merge pull request #2057 from MetaMask/Version-3.9.13
Version 3.9.13
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/lib/inpage-provider.js | 52 |
3 files changed, 32 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a63a8604a..a58180da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ - Add info on token contract addresses. - Add validation preventing users from inputting their own addresses as token tracking addresses. +## 3.9.13 2017-9-8 + +- Changed the way we initialize the inpage provider to fix a bug affecting some developers. + ## 3.9.12 2017-9-6 - Fix bug that prevented Web3 1.0 compatibility diff --git a/app/manifest.json b/app/manifest.json index 256737c89..51e82d6e3 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "3.9.12", + "version": "3.9.13", "manifest_version": 2, "author": "https://metamask.io", "description": "Ethereum Browser Extension", diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index c63af06dc..13888dc67 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -40,31 +40,37 @@ function MetamaskInpageProvider (connectionStream) { // start and stop polling to unblock first block lock self.idMap = {} - // handle sendAsync requests via asyncProvider - self.sendAsync = function (payload, cb) { - // rewrite request ids - var request = eachJsonMessage(payload, (_message) => { - const message = Object.assign({}, _message) - const newId = createRandomId() - self.idMap[newId] = message.id - message.id = newId +} + +// handle sendAsync requests via asyncProvider +// also remap ids inbound and outbound +MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) { + const self = this + + // rewrite request ids + const request = eachJsonMessage(payload, (_message) => { + const message = Object.assign({}, _message) + const newId = createRandomId() + self.idMap[newId] = message.id + message.id = newId + return message + }) + + // forward to asyncProvider + self.asyncProvider.sendAsync(request, (err, _res) => { + if (err) return cb(err) + // transform messages to original ids + const res = eachJsonMessage(_res, (message) => { + const oldId = self.idMap[message.id] + delete self.idMap[message.id] + message.id = oldId return message }) - // forward to asyncProvider - asyncProvider.sendAsync(request, function (err, res) { - if (err) return cb(err) - // transform messages to original ids - eachJsonMessage(res, (message) => { - var oldId = self.idMap[message.id] - delete self.idMap[message.id] - message.id = oldId - return message - }) - cb(null, res) - }) - } + cb(null, res) + }) } + MetamaskInpageProvider.prototype.send = function (payload) { const self = this @@ -110,10 +116,6 @@ MetamaskInpageProvider.prototype.send = function (payload) { } } -MetamaskInpageProvider.prototype.sendAsync = function () { - throw new Error('MetamaskInpageProvider - sendAsync not overwritten') -} - MetamaskInpageProvider.prototype.isConnected = function () { return true } |