It lives!

The inbound (Mono -> Gecko) C++ DOM function is working fine and I can recieve a C# call in JavaScript; now I just need to pass it off to the actual function.

There was a bit of trouble initially as I couldn’t obtain an nsIWebBrowser pointer from gtk_moz_embed_get_nsIWebBrowser. This turned out to be because the Gecko# WebControl hadn’t been shown yet (i.e. window.ShowAll()), but I didn’t figure this out as other functions like gtk_moz_embed_get_location worked fine.

Here’s Blagovest Dachev’s XUL GUI demo hosted in my container, with a simple C#->JS call demonstration. For anyone who hasn’t seen the Mono Summer of Code page, Blago’s working on the Mozilla half of this project.

Screenshot of a function call

Shouldn’t be hard now to get the outbound side working. I’ll have to test how long the JavaScript status messages can be, or I’ll have to finish the outbound C++ glue. Marshalling ‘out’ parameters isn’t too easy, especially when I don’t want to place any artificial limits on the size of the data that can be passed around, so I’ll return the arguments from the function as a string pointer return value. I don’t expect the names of the callee and callback functions to be more than a few hundred characters in the extreme case, so they should be able to be sent in the JavaScript status message.

However, splitting the call in two parts like this could have consequences; there’s no telling what multithreading could do to concurrency. I guess some kind of unique identifier is in order.

I also need to finish all of the error and exception handling at some point, though it seems robust enough at the moment.