Apologies if this is the wrong place for this sort of discussion. I have been developing an application using WebKit/GTK+, and I noticed that the GTK+ wrapper does not contain a means to get the return value from a javascript call (from C).

void webkit_web_view_execute_script(WebKitWebView* webView, const gchar* script);

exists, but is really a fire and forget. I could find nothing else, so I wrote a quick extension:

gchar* webkit_web_view_execute_script_with_retval(WebKitWebView* webView, const gchar* script)
{
    if(!WEBKIT_IS_WEB_VIEW(webView)) return NULL;
    if(!script) return NULL;

    if (FrameLoader* loader = core(webView)->mainFrame()->loader())
    {
JSValue* retval = loader- >executeScript(String::fromUTF8(script), true);
        if(retval)
        {
                UString retstring = retval->getString();
        
                if(retstring == NULL) return NULL;
        
                gchar* gretval = g_utf16_to_utf8((gunichar2*) retstring.data(),
                                retstring.size(),
                                NULL,
                                NULL,
                                NULL);
        
                return gretval;
        }
    }

    return NULL;
}

Not at all patch worthy, but it works, and now I can call into javascript and get return values - I am wondering if there are any plans to implement something like this (but well written) in the future?

Also, I have not been able to get text shadows working on my WebKit/GTK +, but a recent article on Ars suggests it is now working - I am using pango - something else I need to do?

Thanks,
Sean
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to