Merge pull request #305 from ethereum/readonly-fixes

fix safari/ie - attempted to assign to readonly property
pull/1/head
chriseth 8 years ago committed by GitHub
commit 1530f69ade
  1. 26
      src/universal-dapp.js

@ -542,20 +542,21 @@ UniversalDApp.prototype.getCallButton = function (args) {
} }
var decoded 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) { if (err) {
replaceOutput($result, $('<span/>').text(err).addClass('error')) replaceOutput($result, $('<span/>').text(err).addClass('error'))
// VM only // VM only
} else if (self.executionContext.isVM() && result.vm.exception === 0 && result.vm.exceptionError) { } else if (self.executionContext.isVM() && result.vm.exception === 0 && result.vm.exceptionError) {
replaceOutput($result, $('<span/>').text('VM Exception: ' + result.vm.exceptionError).addClass('error')) replaceOutput($result, $('<span/>').text('VM Exception: ' + result.vm.exceptionError).addClass('error'))
$result.append(getDebugTransaction(result)) $result.append(getDebugTransaction(txResult))
// VM only // VM only
} else if (self.executionContext.isVM() && result.vm.return === undefined) { } else if (self.executionContext.isVM() && result.vm.return === undefined) {
replaceOutput($result, $('<span/>').text('Exception during execution.').addClass('error')) replaceOutput($result, $('<span/>').text('Exception during execution.').addClass('error'))
$result.append(getDebugTransaction(result)) $result.append(getDebugTransaction(txResult))
} else if (isConstructor) { } else if (isConstructor) {
replaceOutput($result, getGasUsedOutput(result, result.vm)) replaceOutput($result, getGasUsedOutput(result, result.vm))
$result.append(getDebugTransaction(result)) $result.append(getDebugTransaction(txResult))
args.appendFunctions(self.executionContext.isVM() ? result.createdAddress : result.contractAddress) args.appendFunctions(self.executionContext.isVM() ? result.createdAddress : result.contractAddress)
} else if (self.executionContext.isVM()) { } else if (self.executionContext.isVM()) {
var outputObj = '0x' + result.vm.return.toString('hex') var outputObj = '0x' + result.vm.return.toString('hex')
@ -567,9 +568,9 @@ UniversalDApp.prototype.getCallButton = function (args) {
$result.append(decoded) $result.append(decoded)
} }
if (args.abi.constant) { if (args.abi.constant) {
$result.append(getDebugCall(result)) $result.append(getDebugCall(txResult))
} else { } else {
$result.append(getDebugTransaction(result)) $result.append(getDebugTransaction(txResult))
} }
} else if (args.abi.constant && !isConstructor) { } else if (args.abi.constant && !isConstructor) {
clearOutput($result) clearOutput($result)
@ -582,7 +583,7 @@ UniversalDApp.prototype.getCallButton = function (args) {
} else { } else {
clearOutput($result) clearOutput($result)
$result.append(getReturnOutput(result)).append(getGasUsedOutput(result)) $result.append(getReturnOutput(result)).append(getGasUsedOutput(result))
$result.append(getDebugTransaction(result)) $result.append(getDebugTransaction(txResult))
} }
}) })
} }
@ -673,7 +674,9 @@ function tryTillResponse (web3, txhash, done) {
// Try again with a bit of delay // Try again with a bit of delay
setTimeout(function () { tryTillResponse(web3, txhash, done) }, 500) setTimeout(function () { tryTillResponse(web3, txhash, done) }, 500)
} else { } else {
done(err, address) done(err, {
result: address
})
} }
}) })
} }
@ -827,8 +830,11 @@ UniversalDApp.prototype.rawRunTx = function (args, cb) {
++self.blockNumber ++self.blockNumber
} }
self.vm.runTx({block: block, tx: tx, skipBalance: true, skipNonce: true}, function (err, result) { 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 var transactionHash = self.txdebugger.web3().releaseCurrentHash() // used to keep track of the transaction
cb(err, result) cb(err, {
result: result,
transactionHash: transactionHash
})
}) })
} catch (e) { } catch (e) {
cb(e, null) cb(e, null)

Loading…
Cancel
Save