Bug 21009 - [PATCH] webkit_web_view_execute_script returning an execution result value
Summary: [PATCH] webkit_web_view_execute_script returning an execution result value
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2008-09-22 15:26 PDT by Anton Nonko
Modified: 2017-04-14 04:05 PDT (History)
2 users (show)

See Also:

webkit_web_view_execute_script returning result of execution (3.63 KB, patch)
2008-09-22 15:34 PDT, Anton Nonko
alp: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Nonko 2008-09-22 15:26:54 PDT
This patch makes webkit_web_view_execute_script function to return an execution result value. The value is returned as an UTF8 string like in other bindings. The return value is a pointer to gchar null-terminated string or NULL if error occurred. This pointer is actual before the next call of webkit_web_view_execute_script for same WebKitWebView object or object finalizing.
Calling code should not release pointer returned.
Comment 1 Anton Nonko 2008-09-22 15:34:20 PDT
Created attachment 23675 [details]
webkit_web_view_execute_script returning result of execution
Comment 2 Alp Toker 2008-09-22 17:33:22 PDT
Comment on attachment 23675 [details]
webkit_web_view_execute_script returning result of execution


webkit_web_view_execute_script() was intended for very simple uses only. For anyone needing return values, it's probably more appropriate to use the JavaScriptCore API directly or use the gjs GObject/JavaScript bridge (developed externally to WebKit at the moment).

Even if we have to add a new convenience function like this, I'd prefer not to change webkit_web_view_execute_script() but add a new function clearly named for the purpose.

If you're interested in further JavaScript integration in the API, you could investigate what it would take to get gjs merged into WebKit so we can do more integration.

Marking r- because at the very least this will need a new function (along with documentation). Would be interested to hear the thoughts of others on this.
Comment 3 Anton Nonko 2008-09-22 23:35:28 PDT
This change as a full analogue of runScript() method of wxWebView class in wx port. It's still very simple and doesn't affect existing user code.

I consider that the best way is using gjs but exactly for very simple cases it may be useful.
Comment 4 Martin Robinson 2017-04-14 04:05:23 PDT
Going to close this as the WebKit 1 API has been removed for quite some time.