syscall: Revert "release a js.Func object in fsCall"

This reverts CL 217417 (commit 753d56d364).

This change was unintentionally submitted to master during the
Go 1.14 code freeze; it should be sent again for Go 1.15.

Change-Id: Ie790342f227ae3adfc5f9a90ce3abdc2c9be619b
Reviewed-on: https://go-review.googlesource.com/c/go/+/217721
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
Dmitri Shuralyov 2020-02-04 18:07:23 +00:00
parent 334ab8311c
commit e6ebbe0d20
1 changed files with 2 additions and 4 deletions

View File

@ -495,7 +495,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
}
c := make(chan callResult, 1)
f := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
jsFS.Call(name, append(args, js.FuncOf(func(this js.Value, args []js.Value) interface{} {
var res callResult
if len(args) >= 1 { // on Node.js 8, fs.utimes calls the callback without any arguments
@ -511,9 +511,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
c <- res
return nil
})
defer f.Release()
jsFS.Call(name, append(args, f)...)
}))...)
res := <-c
return res.val, res.err
}