From f213ca695c665450ba9a3fe7475c9ed6f3e98a14 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 10:03:10 -0700 Subject: [PATCH 1/8] Fix typos and refine wording. --- ui/app/components/buy-button-subview.js | 2 +- ui/app/eth-store-warning.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/app/components/buy-button-subview.js b/ui/app/components/buy-button-subview.js index 742241e5b..c3e9e5d7b 100644 --- a/ui/app/components/buy-button-subview.js +++ b/ui/app/components/buy-button-subview.js @@ -106,7 +106,7 @@ BuyButtonSubview.prototype.formVersionSubview = function () { style: { width: '225px', }, - }, 'In order to access this feature please switch too the Main Network'), + }, 'In order to access this feature please switch to the Main Network'), h('h3.text-transform-uppercase', 'or:'), this.props.network === '2' ? h('button.text-transform-uppercase', { onClick: () => this.props.dispatch(actions.buyEth()), diff --git a/ui/app/eth-store-warning.js b/ui/app/eth-store-warning.js index 55274996b..fe3c7ce5d 100644 --- a/ui/app/eth-store-warning.js +++ b/ui/app/eth-store-warning.js @@ -35,10 +35,9 @@ EthStoreWarning.prototype.render = function () { margin: '10px 10px 10px 10px', }, }, - `The MetaMask team would like to - remind you that MetaMask is currently in beta - so - don't store large - amounts of ether in MetaMask. + `MetaMask is currently in beta; use + caution in storing large + amounts of ether. `), h('i.fa.fa-exclamation-triangle.fa-4', { From 9cb600e17ab43f897abfd874d70ca72221437b9c Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 10:24:31 -0700 Subject: [PATCH 2/8] Redirect to video in a new tab on fresh install. --- app/scripts/background.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 5dae8235f..91c09629c 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -35,6 +35,12 @@ function showUnconfirmedTx (txParams, txData, onTxDoneCb) { notification.show() } +// On first install, open a window to MetaMask website to how-it-works. + +chrome.runtime.onInstalled.addListener(function (object) { + chrome.tabs.create({url: 'https://metamask.io/#how-it-works'}) +}) + // // connect to other contexts // @@ -160,4 +166,3 @@ function getOldStyleData () { function setData (data) { window.localStorage[STORAGE_KEY] = JSON.stringify(data) } - From 41632114c0ec8e92d7594a41fec4dfd0f9d7f832 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 10:25:14 -0700 Subject: [PATCH 3/8] Add to changelog. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 178879e8a..83d576651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Current Master +- On fresh install, open a new tab with the MetaMask Introduction video. + ## 2.10.2 2016-09-02 - Fix bug where notification popup would not display. From 50f0624ea800b0b763f577171e451495c16cd6e9 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 10:27:11 -0700 Subject: [PATCH 4/8] Replace chrome with generalized browser API. --- app/scripts/background.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 91c09629c..21a5eea65 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -37,8 +37,8 @@ function showUnconfirmedTx (txParams, txData, onTxDoneCb) { // On first install, open a window to MetaMask website to how-it-works. -chrome.runtime.onInstalled.addListener(function (object) { - chrome.tabs.create({url: 'https://metamask.io/#how-it-works'}) +extension.runtime.onInstalled.addListener(function (object) { + extension.tabs.create({url: 'https://metamask.io/#how-it-works'}) }) // From f4e131da0a4fef1f3a0d8c193999011b8d83e99d Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 11:04:54 -0700 Subject: [PATCH 5/8] Fix capitalization. --- ui/app/components/account-info-link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/components/account-info-link.js b/ui/app/components/account-info-link.js index 4fe3b8b5d..49c42e9ec 100644 --- a/ui/app/components/account-info-link.js +++ b/ui/app/components/account-info-link.js @@ -14,7 +14,7 @@ function AccountInfoLink () { AccountInfoLink.prototype.render = function () { const { selected, network } = this.props - const title = 'View account on etherscan' + const title = 'View account on Etherscan' const url = genAccountLink(selected, network) if (!url) { From 01618a88aa28a1302908b393428397e7a29416b4 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 15:30:30 -0700 Subject: [PATCH 6/8] Update changelog and merge master. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83d576651..9021fdf01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Current Master - On fresh install, open a new tab with the MetaMask Introduction video. +- Block negative values from transactions. ## 2.10.2 2016-09-02 From bfea26d3e3d12de6ce9bbc01ad24a42d846021e5 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 18:56:26 -0700 Subject: [PATCH 7/8] Ensure listener is cleaned up Also fixed bug when validating a tx with no value. --- app/scripts/background.js | 1 + app/scripts/lib/listener-manager.js | 25 +++++++++++++++++++++++++ app/scripts/metamask-controller.js | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/scripts/lib/listener-manager.js diff --git a/app/scripts/background.js b/app/scripts/background.js index 21a5eea65..18aaed7bf 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -86,6 +86,7 @@ function setupControllerConnection (stream) { stream.pipe(dnode).pipe(stream) dnode.on('remote', (remote) => { // push updates to popup + controller.ethStore.removeListener('update', controller.sendUpdate.bind(controller)) controller.ethStore.on('update', controller.sendUpdate.bind(controller)) controller.listeners.push(remote) idStore.on('update', controller.sendUpdate.bind(controller)) diff --git a/app/scripts/lib/listener-manager.js b/app/scripts/lib/listener-manager.js new file mode 100644 index 000000000..9e3c71afc --- /dev/null +++ b/app/scripts/lib/listener-manager.js @@ -0,0 +1,25 @@ +module.exports = class ListenerManager { + + constructor() { + this.cleaners = {} + } + + setup (name) { + if (!(name in this.cleaners)) { + this.cleaners[name] = [] + } + } + + addCleanup (name, cleaner) { + this.setup(name) + } + + cleanupOldListeners (name) { + this.setup(name) + this.cleaners[name].forEach((cleaner) => { + cleaner() + }) + this.cleaners[name] = [] + } + +} diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 83827ec76..5373cf0d9 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -220,7 +220,7 @@ module.exports = class MetamaskController { } enforceTxValidations (txParams) { - if (txParams.value.indexOf('-') === 0) { + if (('value' in txParams) && txParams.value.indexOf('-') === 0) { const msg = `Invalid transaction value of ${txParams.value} not a positive number.` return new Error(msg) } From 2564c0c51c39e428540e38b80558e45ec44357a8 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 18:57:18 -0700 Subject: [PATCH 8/8] Bump changelog --- CHANGELOG.md | 1 + app/scripts/lib/listener-manager.js | 25 ------------------------- 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 app/scripts/lib/listener-manager.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 9021fdf01..bea356ab6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - On fresh install, open a new tab with the MetaMask Introduction video. - Block negative values from transactions. +- Fixed a memory leak. ## 2.10.2 2016-09-02 diff --git a/app/scripts/lib/listener-manager.js b/app/scripts/lib/listener-manager.js deleted file mode 100644 index 9e3c71afc..000000000 --- a/app/scripts/lib/listener-manager.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = class ListenerManager { - - constructor() { - this.cleaners = {} - } - - setup (name) { - if (!(name in this.cleaners)) { - this.cleaners[name] = [] - } - } - - addCleanup (name, cleaner) { - this.setup(name) - } - - cleanupOldListeners (name) { - this.setup(name) - this.cleaners[name].forEach((cleaner) => { - cleaner() - }) - this.cleaners[name] = [] - } - -}