[Webkit-unassigned] [Bug 75543] [GTK] Add webkit_web_view_run_javascript() to WebKit2 GTK+

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Feb 19 08:05:13 PST 2012


--- Comment #10 from Carlos Garcia Campos <cgarcia at igalia.com>  2012-02-19 08:05:13 PST ---
(In reply to comment #9)
> (In reply to comment #8)
> > > It seems that there are three things we want to return for every JavaScript invocation: a JSContextRef, a JSValueRef and a JSValueRef for exceptions. I'm not sure the cleanest way to pass all this to the user with the GIO style API.
> > 
> > why not?
> Sorry. This was a little unclear. What I meant here was that I couldn't quickly find any examples of this kind of situation with the GIO style APIs in devhelp.

There a lot of examples in GFile API, for example g_file_query_info_async(), g_file_query_info_finish() returns a GFileInfo object.

> I guessed that you would just need to implement your own GAsyncResult, but I wasn't confident enough to suggest it.

No, we can use a GSimpleAsyncResult and store the object with g_simple_async_result_set_op_res_gpointer().

> I didn't mean to say that we should do away with GIO style APIs.

Ok, no problem.

> > So as I suggested before, we could just return a WebKitJavascriptResult object (or boxed type, maybe) containing the context, the value and the exception.
> That sound like a good plan.
> > I didn't do that because with the current code the JSValueRef is a temporary value that is no longer alive after the execution of the callback. If we use the WebKitJavascriptResult, we could just store the result. I didn't like having to use a callback either.
> Great.
> One thing that I think would be useful is to create only one JSGlobalContext for the entire WebKitWebView. Every deserialized JavaScript result could use that same global context. This would be useful because it would allow the user to create other bits of JavaScript and even to pass the return values of these APIs to functions that they create. You could add a getter to WebKitWebView for this global context.

Ok, created on demand I guess?

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list