remove reference when unloading

pull/1/head
yann300 7 years ago
parent d44857ae8e
commit 74a8625f5f
  1. 1
      src/app/debugger/remix-debugger/src/ui/ButtonNavigator.js
  2. 13
      src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js
  3. 10
      src/app/debugger/remix-debugger/src/ui/StepManager.js
  4. 21
      src/app/debugger/remix-debugger/src/ui/VmDebugger.js

@ -51,6 +51,7 @@ function ButtonNavigator (_parent, _traceManager) {
this.revertionPoint = null
_parent.event.register('indexChanged', this, (index) => {
if (!this.view) return
if (index < 0) return
if (_parent.currentStepIndex !== index) return

@ -68,7 +68,6 @@ function EthdebuggerUI (opts) {
this.txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) {
self.unLoad()
})
}
EthdebuggerUI.prototype.setManagers = function () {
@ -163,7 +162,7 @@ EthdebuggerUI.prototype.setCompilationResult = function (compilationResult) {
EthdebuggerUI.prototype.debug = function (tx) {
this.setCompilationResult(this.opts.compilationResult())
if (tx instanceof Object) {
this.txBrowser.load(tx.hash)
this.txBrowser.load(tx.hash, tx)
} else if (tx instanceof String) {
this.txBrowser.load(tx)
}
@ -188,6 +187,12 @@ EthdebuggerUI.prototype.unLoad = function () {
// this.debugger.codeManager.clear()
// this.debugger.stepManager.reset()
this.debugger.unLoad()
yo.update(this.debuggerPanelsView, yo`<div></div>`)
yo.update(this.stepManagerView, yo`<div></div>`)
if (this.vmDebugger) this.vmDebugger.remove()
if (this.stepManager) this.stepManager.remove()
this.vmDebugger = null
this.stepManager = null
this.event.trigger('traceUnloaded')
}
@ -236,10 +241,6 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) {
// console.dir(this.vmDebugger.render())
// console.dir(this.view)
self.debugger.event.register('newTraceLoaded', function () {
// self.
})
console.dir('resolving a trace with tx: ')
console.dir(tx)
// this.debugger.traceManager.resolveTrace(tx, function (error, result) {

@ -15,6 +15,7 @@ function StepManager (_parent, _traceManager) {
var self = this
this.parent.event.register('newTraceLoaded', this, function () {
if (!this.slider) return
self.traceManager.getLength(function (error, length) {
if (error) {
console.log(error)
@ -33,6 +34,7 @@ function StepManager (_parent, _traceManager) {
})
this.parent.callTree.event.register('callTreeReady', () => {
if (!this.slider) return
if (this.parent.callTree.functionCallStack.length) {
this.jumpTo(this.parent.callTree.functionCallStack[0])
}
@ -65,6 +67,14 @@ function StepManager (_parent, _traceManager) {
})
}
StepManager.prototype.remove = function () {
// used to stop listenning on event. bad and should be "refactored"
this.slider.view = null
this.slider = null
this.buttonNavigator.view = null
this.buttonNavigator = null
}
StepManager.prototype.resolveToReducedTrace = function (value, incr) {
if (this.parent.callTree.reducedTrace.length) {
var nextSource = util.findClosestIndex(value, this.parent.callTree.reducedTrace)

@ -27,7 +27,8 @@ var css = csjs`
function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _callTree) {
let _parent = _parentUI.debugger
var self = this
this.view
this.asmCode = new CodeListView(_parent, _codeManager)
this.stackPanel = new StackPanel(_parentUI, _traceManager)
this.storagePanel = new StoragePanel(_parentUI, _traceManager)
@ -42,12 +43,13 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
this.returnValuesPanel = new DropdownPanel('Return Value', {json: true})
this.returnValuesPanel.data = {}
_parentUI.event.register('indexChanged', this.returnValuesPanel, function (index) {
var self = this
if (!self.view) return
var innerself = this
_traceManager.getReturnValue(index, function (error, returnValue) {
if (error) {
self.update([error])
innerself.update([error])
} else if (_parentUI.currentStepIndex === index) {
self.update([returnValue])
innerself.update([returnValue])
}
})
})
@ -55,9 +57,8 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parentUI, _traceManager)
this.view
var self = this
_parent.event.register('newTraceLoaded', this, function () {
if (!self.view) return
var storageResolver = new StorageResolver({web3: _parent.web3})
self.storagePanel.storageResolver = storageResolver
self.solidityState.storageResolver = storageResolver
@ -71,11 +72,12 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
self.view.style.display = 'none'
})
_parent.callTree.event.register('callTreeReady', () => {
self.asmCode.basicPanel.show()
if (!self.view) return
if (_parent.callTree.reducedTrace.length) {
self.solidityLocals.basicPanel.show()
self.solidityState.basicPanel.show()
}
self.asmCode.basicPanel.show()
self.stackPanel.basicPanel.show()
self.storagePanel.basicPanel.show()
self.memoryPanel.basicPanel.show()
@ -97,6 +99,11 @@ VmDebugger.prototype.renderHead = function () {
return headView
}
VmDebugger.prototype.remove = function () {
// used to stop listenning on event. bad and should be "refactored"
this.view = null
}
VmDebugger.prototype.render = function () {
var view = yo`<div id='vmdebugger' style='display:none'>
<div>

Loading…
Cancel
Save