From cb9cdb974822c02d1eecdc5275f2ae58f1c64267 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 1 Nov 2016 16:21:44 +0100 Subject: [PATCH 1/2] fix safari/ie - attempted to assign to readonly property --- src/universal-dapp.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 9b7185e020..f9b0829d25 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -542,20 +542,21 @@ UniversalDApp.prototype.getCallButton = function (args) { } var decoded - self.runTx({ to: args.address, data: data, useCall: args.abi.constant && !isConstructor }, function (err, result) { + self.runTx({ to: args.address, data: data, useCall: args.abi.constant && !isConstructor }, function (err, txResult) { + var result = txResult.result if (err) { replaceOutput($result, $('').text(err).addClass('error')) // VM only } else if (self.executionContext.isVM() && result.vm.exception === 0 && result.vm.exceptionError) { replaceOutput($result, $('').text('VM Exception: ' + result.vm.exceptionError).addClass('error')) - $result.append(getDebugTransaction(result)) + $result.append(getDebugTransaction(txResult)) // VM only } else if (self.executionContext.isVM() && result.vm.return === undefined) { replaceOutput($result, $('').text('Exception during execution.').addClass('error')) - $result.append(getDebugTransaction(result)) + $result.append(getDebugTransaction(txResult)) } else if (isConstructor) { replaceOutput($result, getGasUsedOutput(result, result.vm)) - $result.append(getDebugTransaction(result)) + $result.append(getDebugTransaction(txResult)) args.appendFunctions(self.executionContext.isVM() ? result.createdAddress : result.contractAddress) } else if (self.executionContext.isVM()) { var outputObj = '0x' + result.vm.return.toString('hex') @@ -567,9 +568,9 @@ UniversalDApp.prototype.getCallButton = function (args) { $result.append(decoded) } if (args.abi.constant) { - $result.append(getDebugCall(result)) + $result.append(getDebugCall(txResult)) } else { - $result.append(getDebugTransaction(result)) + $result.append(getDebugTransaction(txResult)) } } else if (args.abi.constant && !isConstructor) { clearOutput($result) @@ -582,7 +583,7 @@ UniversalDApp.prototype.getCallButton = function (args) { } else { clearOutput($result) $result.append(getReturnOutput(result)).append(getGasUsedOutput(result)) - $result.append(getDebugTransaction(result)) + $result.append(getDebugTransaction(txResult)) } }) } @@ -827,8 +828,11 @@ UniversalDApp.prototype.rawRunTx = function (args, cb) { ++self.blockNumber } self.vm.runTx({block: block, tx: tx, skipBalance: true, skipNonce: true}, function (err, result) { - result.transactionHash = self.txdebugger.web3().releaseCurrentHash() // used to keep track of the transaction - cb(err, result) + var transactionHash = self.txdebugger.web3().releaseCurrentHash() // used to keep track of the transaction + cb(err, { + result: result, + transactionHash: transactionHash + }) }) } catch (e) { cb(e, null) From 4db9d6cdd11732fec191c1e4a56654f21da6bf10 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 7 Nov 2016 12:37:37 +0100 Subject: [PATCH 2/2] fix web3 according to the safari fix --- src/universal-dapp.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index f9b0829d25..8dd206921b 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -674,7 +674,9 @@ function tryTillResponse (web3, txhash, done) { // Try again with a bit of delay setTimeout(function () { tryTillResponse(web3, txhash, done) }, 500) } else { - done(err, address) + done(err, { + result: address + }) } }) }