From 7256894f51e3ef3073d7c5d8ab7b745ee5d36d2b Mon Sep 17 00:00:00 2001 From: Alex Lunyov Date: Thu, 21 Sep 2017 15:13:53 +0800 Subject: Fix CORS issues in FireFox --- app/manifest.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/manifest.json b/app/manifest.json index 67fb543b9..05e8d30de 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -57,7 +57,11 @@ "permissions": [ "storage", "clipboardWrite", - "http://localhost:8545/" + "http://localhost:8545/", + "https://rinkeby.infura.io/metamask/", + "https://mainnet.infura.io/metamask/", + "https://ropsten.infura.io/metamask/", + "https://kovan.infura.io/metamask/" ], "web_accessible_resources": [ "scripts/inpage.js" -- cgit From bfaacd311806b9ff902f0b5178469b5ef9133358 Mon Sep 17 00:00:00 2001 From: Alex Lunyov Date: Fri, 22 Sep 2017 12:14:04 +0800 Subject: Wildcard for infura.io permissions, added permission for cryptonator api --- app/manifest.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/manifest.json b/app/manifest.json index 05e8d30de..83a967a26 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -58,10 +58,8 @@ "storage", "clipboardWrite", "http://localhost:8545/", - "https://rinkeby.infura.io/metamask/", - "https://mainnet.infura.io/metamask/", - "https://ropsten.infura.io/metamask/", - "https://kovan.infura.io/metamask/" + "https://*.infura.io/", + "https://api.cryptonator.com" ], "web_accessible_resources": [ "scripts/inpage.js" -- cgit From 36bc8f3c60ffbcc3789a683a6a74a52e355c0c2b Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 2 Oct 2017 10:59:15 -0700 Subject: Update manifest.json --- app/manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/manifest.json b/app/manifest.json index 83a967a26..5f8cf6979 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -58,8 +58,7 @@ "storage", "clipboardWrite", "http://localhost:8545/", - "https://*.infura.io/", - "https://api.cryptonator.com" + "https://*.infura.io/" ], "web_accessible_resources": [ "scripts/inpage.js" -- cgit From e68261130142db52cb3cf0d94633f560a87c0655 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 2 Oct 2017 11:35:26 -0700 Subject: deps - bump pe for block cache fix --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b9a38ac71..918531f15 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "valid-url": "^1.0.9", "vreme": "^3.0.2", "web3": "^0.20.1", - "web3-provider-engine": "^13.2.12", + "web3-provider-engine": "^13.3.1", "web3-stream-provider": "^3.0.1", "xtend": "^4.0.1" }, -- cgit From d29b5f10ef5137ab56ecc9615e5e894082db9803 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 2 Oct 2017 13:14:42 -0700 Subject: tx state history - fix bug where initial snapshot was mutated on updateTx --- app/scripts/lib/tx-state-history-helper.js | 3 ++- app/scripts/lib/tx-state-manager.js | 2 +- test/unit/tx-state-history-helper.js | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/tx-state-history-helper.js b/app/scripts/lib/tx-state-history-helper.js index 304069d57..5ebd78689 100644 --- a/app/scripts/lib/tx-state-history-helper.js +++ b/app/scripts/lib/tx-state-history-helper.js @@ -24,7 +24,8 @@ function generateHistoryEntry(previousState, newState) { return jsonDiffer.compare(previousState, newState) } -function replayHistory(shortHistory) { +function replayHistory(_shortHistory) { + const shortHistory = clone(_shortHistory) return shortHistory.reduce((val, entry) => jsonDiffer.applyPatch(val, entry).newDocument) } diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index abb9d7910..4493889bf 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -97,7 +97,7 @@ module.exports = class TransactionStateManger extends EventEmitter { const previousState = txStateHistoryHelper.replayHistory(txMeta.history) // generate history entry and add to history const entry = txStateHistoryHelper.generateHistoryEntry(previousState, currentState) - txMeta.history.push(entry) + txMeta.history.push(entry) // commit txMeta to state const txId = txMeta.id diff --git a/test/unit/tx-state-history-helper.js b/test/unit/tx-state-history-helper.js index 5bb6c9bee..e5075af88 100644 --- a/test/unit/tx-state-history-helper.js +++ b/test/unit/tx-state-history-helper.js @@ -20,4 +20,26 @@ describe('tx-state-history-helper', function () { }) }) }) + + it('replaying history does not mutate the original obj', function () { + const initialState = { test: true, message: 'hello', value: 1 } + const diff1 = { + "op": "replace", + "path": "/message", + "value": "haay", + } + const diff2 = { + "op": "replace", + "path": "/value", + "value": 2, + } + const history = [initialState, diff1, diff2] + + const beforeStateSnapshot = JSON.stringify(initialState) + const latestState = txStateHistoryHelper.replayHistory(history) + const afterStateSnapshot = JSON.stringify(initialState) + + assert.notEqual(initialState, latestState, 'initial state is not the same obj as the latest state') + assert.equal(beforeStateSnapshot, afterStateSnapshot, 'initial state is not modified during run') + }) }) -- cgit