diff options
author | Dequis <dx@dxzone.com.ar> | 2009-06-15 20:37:55 -0300 |
---|---|---|
committer | Dequis <dx@dxzone.com.ar> | 2009-06-15 20:37:55 -0300 |
commit | fedfe2c06b3e01d5dede2cbab395a0ab48bb94e9 (patch) | |
tree | 0de88a92485794a9c48ae876a708a748a9356208 /uzbl.h | |
parent | ed39cbe56f8923407604a1306a179529521ecd26 (diff) |
Use JavaScriptCore for evaluation, with Uzbl.run()
Both "js" and "script" commands use eval_js(), which creates an instance
of the Uzbl object class (created by js_init()) which right now provides
only a run() method (handled by js_run_command()). After evaluating the
code, eval_js() removes the object so the scripts from the loaded page
can't access it.
eval_js() supports returning a string result, and you can use it with
uzblctrl to query the DOM. Uzbl.run() also returns a string, but the
only useful thing you can do right now with that is to print @uri or
other variables.
Diffstat (limited to 'uzbl.h')
-rw-r--r-- | uzbl.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -176,6 +176,12 @@ typedef struct { GHashTable* commands; } Behaviour; +/* javascript */ +typedef struct { + gboolean initialized; + JSClassDefinition classdef; + JSClassRef classref; +} Javascript; /* main uzbl data structure */ typedef struct { @@ -184,6 +190,7 @@ typedef struct { Network net; Behaviour behave; Communication comm; + Javascript js; Window xwin; GScanner *scan; @@ -458,6 +465,9 @@ static void dehilight (WebKitWebView *page, GArray *argv, GString *result); static void +eval_js(WebKitWebView * web_view, gchar *script, GString *result); + +static void run_js (WebKitWebView * web_view, GArray *argv, GString *result); static void |