mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-26 05:27:19 +00:00
Merge pull request #876 from obscuren/jsre_fixes
jsre, cmd/geth: updated web3.js and altered settimeout
This commit is contained in:
commit
15bfae52d2
@ -117,12 +117,6 @@ func (js *jsre) apiBindings(f xeth.Frontend) {
|
|||||||
utils.Fatalf("Error loading bignumber.js: %v", err)
|
utils.Fatalf("Error loading bignumber.js: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to declare a dummy setTimeout. Otto does not support it
|
|
||||||
_, err = js.re.Eval("setTimeout = function(cb, delay) {};")
|
|
||||||
if err != nil {
|
|
||||||
utils.Fatalf("Error defining setTimeout: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = js.re.Compile("ethereum.js", re.Ethereum_JS)
|
err = js.re.Compile("ethereum.js", re.Ethereum_JS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatalf("Error loading ethereum.js: %v", err)
|
utils.Fatalf("Error loading ethereum.js: %v", err)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 3b799d128452639463424c657956ee90a28daec6
|
Subproject commit 08f3aaea8cad2cf07276d6709e2ee384afe90d3c
|
File diff suppressed because one or more lines are too long
10
jsre/jsre.go
10
jsre/jsre.go
@ -143,6 +143,10 @@ func (self *JSRE) runEventLoop() {
|
|||||||
}
|
}
|
||||||
return otto.UndefinedValue()
|
return otto.UndefinedValue()
|
||||||
}
|
}
|
||||||
|
self.vm.Set("setTimeout", setTimeout)
|
||||||
|
self.vm.Set("setInterval", setInterval)
|
||||||
|
self.vm.Set("clearTimeout", clearTimeout)
|
||||||
|
self.vm.Set("clearInterval", clearTimeout)
|
||||||
|
|
||||||
var waitForCallbacks bool
|
var waitForCallbacks bool
|
||||||
|
|
||||||
@ -165,7 +169,7 @@ loop:
|
|||||||
_, err := self.vm.Call(`Function.call.call`, nil, arguments...)
|
_, err := self.vm.Call(`Function.call.call`, nil, arguments...)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break loop
|
fmt.Println("js error:", err, arguments)
|
||||||
}
|
}
|
||||||
if timer.interval {
|
if timer.interval {
|
||||||
timer.timer.Reset(timer.duration)
|
timer.timer.Reset(timer.duration)
|
||||||
@ -177,10 +181,6 @@ loop:
|
|||||||
}
|
}
|
||||||
case evalReq := <-self.evalQueue:
|
case evalReq := <-self.evalQueue:
|
||||||
// run the code, send the result back
|
// run the code, send the result back
|
||||||
self.vm.Set("setTimeout", setTimeout)
|
|
||||||
self.vm.Set("setInterval", setInterval)
|
|
||||||
self.vm.Set("clearTimeout", clearTimeout)
|
|
||||||
self.vm.Set("clearInterval", clearTimeout)
|
|
||||||
evalReq.fn(&evalReq.res)
|
evalReq.fn(&evalReq.res)
|
||||||
close(evalReq.done)
|
close(evalReq.done)
|
||||||
if waitForCallbacks && (len(registry) == 0) {
|
if waitForCallbacks && (len(registry) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user