Open JanGordon opened 1 year ago
I am creating an object and I want to add the toString method but whenever using that name it seg faults. I can use another name for the method and it works as expected.
Here's the code to reproduce:
package main import ( "fmt" "rogchap.com/v8go" ) func failingExample() { fmt.Println("running failing example") iso := v8go.NewIsolate() global := v8go.NewObjectTemplate(iso) obj := v8go.NewObjectTemplate(iso) global.Set("obj", obj) obj.Set("toString", v8go.NewFunctionTemplate(iso, func(info *v8go.FunctionCallbackInfo) *v8go.Value { self := info.This() fmt.Println(self) return nil })) ctx := v8go.NewContext(iso, global) ctx.RunScript("var p = obj.toString('hello world')", "print.js") } func workingExample() { fmt.Println("running working example") iso := v8go.NewIsolate() global := v8go.NewObjectTemplate(iso) obj := v8go.NewObjectTemplate(iso) global.Set("obj", obj) obj.Set("toStrin", v8go.NewFunctionTemplate(iso, func(info *v8go.FunctionCallbackInfo) *v8go.Value { self := info.This() fmt.Println(self) return nil })) ctx := v8go.NewContext(iso, global) ctx.RunScript("var p = obj.toStrin('hello world')", "print.js") } func main() { workingExample() failingExample() }
I am creating an object and I want to add the toString method but whenever using that name it seg faults. I can use another name for the method and it works as expected.
Here's the code to reproduce: