diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-09-07 06:29:36 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-09-07 06:29:36 +0800 |
commit | 58a8f02294eb1079d92cdf1e6d05a74a224029c3 (patch) | |
tree | fb723445e877bc316b060edcbe76284edf05f889 /app | |
parent | b2ebb6032d3f99eb0e9eb90364a0cd95c7775bde (diff) | |
parent | 095a40e33d40bc02ef6a6b7379eb6c90e0b4c3d8 (diff) | |
download | tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.tar tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.tar.gz tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.tar.bz2 tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.tar.lz tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.tar.xz tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.tar.zst tangerine-wallet-browser-58a8f02294eb1079d92cdf1e6d05a74a224029c3.zip |
Merge branch 'master' into ModularFiatBalance
Diffstat (limited to 'app')
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/lib/inpage-provider.js | 5 | ||||
-rw-r--r-- | app/scripts/lib/notifications.js | 42 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 10 |
4 files changed, 38 insertions, 21 deletions
diff --git a/app/manifest.json b/app/manifest.json index 5444007fa..0fee3f051 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "2.10.0", + "version": "2.10.2", "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 3b7d76c7d..4f9fa1a7d 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -80,7 +80,8 @@ MetamaskInpageProvider.prototype.send = function (payload) { // throw not-supported Error default: - var message = 'The MetaMask Web3 object does not support synchronous methods. See https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#all-async---think-of-metamask-as-a-light-client for details.' + var message = 'The MetaMask Web3 object does not support synchronous methods like ' + payload.method + + '. See https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#all-async---think-of-metamask-as-a-light-client for details.' throw new Error(message) } @@ -131,4 +132,4 @@ function eachJsonMessage(payload, transformFn){ } else { return transformFn(payload) } -}
\ No newline at end of file +} diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js index df4fe73dd..4e3f7558c 100644 --- a/app/scripts/lib/notifications.js +++ b/app/scripts/lib/notifications.js @@ -9,20 +9,26 @@ module.exports = notifications window.METAMASK_NOTIFIER = notifications function show () { - getWindows((windows) => { + getPopup((err, popup) => { + if (err) throw err - if (windows.length > 0) { - const win = windows[0] - return extension.windows.update(win.id, { focused: true }) - } + if (popup) { + + // bring focus to existing popup + extension.windows.update(popup.id, { focused: true }) + + } else { - extension.windows.create({ - url: 'notification.html', - type: 'popup', - focused: true, - width: 360, - height: 500, - }) + // create new popup + extension.windows.create({ + url: 'notification.html', + type: 'popup', + focused: true, + width: 360, + height: 500, + }) + + } }) } @@ -38,19 +44,19 @@ function getWindows(cb) { } function getPopup(cb) { - getWindows((windows) => { - cb(getPopupIn(windows)) + getWindows((err, windows) => { + if (err) throw err + cb(null, getPopupIn(windows)) }) } function getPopupIn(windows) { - return windows ? windows.find((win) => { - return win.type === 'popup' - }) : null + return windows ? windows.find((win) => win.type === 'popup') : null } function closePopup() { - getPopup((popup) => { + getPopup((err, popup) => { + if (err) throw err if (!popup) return extension.windows.remove(popup.id, console.error) }) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index e94db2dfd..83827ec76 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -199,6 +199,9 @@ module.exports = class MetamaskController { const idStore = this.idStore var state = idStore.getState() + let err = this.enforceTxValidations(txParams) + if (err) return onTxDoneCb(err) + // It's locked if (!state.isUnlocked) { @@ -216,6 +219,13 @@ module.exports = class MetamaskController { } } + enforceTxValidations (txParams) { + if (txParams.value.indexOf('-') === 0) { + const msg = `Invalid transaction value of ${txParams.value} not a positive number.` + return new Error(msg) + } + } + newUnsignedMessage (msgParams, cb) { var state = this.idStore.getState() if (!state.isUnlocked) { |