sourcegraph / webloop

WebLoop: Scriptable, headless WebKit with a Go API. Like PhantomJS, but for Go.
https://sourcegraph.com/github.com/sourcegraph/webloop
BSD 3-Clause "New" or "Revised" License
1.37k stars 84 forks source link

missing marshaler for type #29

Open biter777 opened 5 years ago

biter777 commented 5 years ago

I try to use a exapmle:

    gtk.Init(nil)
    go func() {
        runtime.LockOSThread()
        gtk.Main()
    }()

    ctx := webloop.New()
    view := ctx.NewView()
    defer view.Close()
    view.Open("http://google.com")
    err := view.Wait()      // error in runtime
    if err != nil {
        fmt.Fprintf(os.Stderr, "Failed to load URL: %s", err)
        os.Exit(1)
    }
    res, err := view.EvaluateJavaScript("document.title")
    if err != nil {
        fmt.Fprintf(os.Stderr, "Failed to run JavaScript: %s", err)
        os.Exit(1)
    }
    fmt.Printf("JavaScript returned: %q\n", res)

It compiles, but gives an error in runtime: "warning: no suitable Go value from object for arg 0: missing marshaler for type"

go1.12.7 linux/amd64 Ubuntu 18.04.2 LTS

How to fix it? Thnx

maitredede commented 4 years ago

Hi, I have the same behavior. It is related to library https://github.com/gotk3/gotk3 that does not know how to translate a type into a Go struct. There are marshallers for many widgets, but the missing one in our case is related to library https://github.com/sourcegraph/go-webkit2 that did not register marshallers for its types. I extended gotk3 to have the missing type name...

sdobz commented 4 years ago

@MaitreDede could you share your fork? I'm running into the same issue