diff options
-rw-r--r-- | api/dwb-js.7 | 9 | ||||
-rw-r--r-- | api/jsapi.7.txt | 1 | ||||
-rw-r--r-- | api/jsapi.txt | 12 | ||||
-rw-r--r-- | src/scripts.c | 11 |
4 files changed, 31 insertions, 2 deletions
diff --git a/api/dwb-js.7 b/api/dwb-js.7 index ccdf37cd..4a9c8d02 100644 --- a/api/dwb-js.7 +++ b/api/dwb-js.7 @@ -2,12 +2,12 @@ .\" Title: dwb-js .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> -.\" Date: 01/26/2013 +.\" Date: 01/27/2013 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "DWB\-JS" "7" "01/26/2013" "\ \&" "\ \&" +.TH "DWB\-JS" "7" "01/27/2013" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -90,6 +90,11 @@ for details\&. .RS 4 Refers to the global object .RE +.PP +\fIwebkitSession (SoupSession, read)\fR +.RS 4 +The webkit session +.RE .SS "Methods" .sp .it 1 an-trap diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt index 62056b3e..1ec49f0c 100644 --- a/api/jsapi.7.txt +++ b/api/jsapi.7.txt @@ -45,6 +45,7 @@ properties on the global object, see also *Global data* for details. === Properties _global (Object, read)_;; Refers to the global object +_webkitSession (SoupSession, read)_;; The webkit session === Methods === diff --git a/api/jsapi.txt b/api/jsapi.txt index f48c30e8..0b3579ff 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -52,6 +52,18 @@ global object read Refers to the global object. **** +**** +[float] +==== *webkitSession* ==== + +[source,javascript] +---- +webkitSession SoupSession read +---- + +The webkit session. +**** + === Methods === diff --git a/src/scripts.c b/src/scripts.c index f3989656..502715eb 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -129,6 +129,7 @@ static GQuark s_ref_quark; static JSObjectRef s_init_before, s_init_after; static JSObjectRef s_constructors[CONSTRUCTOR_LAST]; static gboolean s_opt_force = false; +static JSObjectRef s_soup_session; /* Only defined once */ static JSValueRef UNDEFINED, NIL; @@ -879,6 +880,11 @@ global_get(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef { return JSContextGetGlobalObject(ctx); } +static JSValueRef +global_get_webkit_session(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception) +{ + return s_soup_session; +} /* global_execute {{{*/ static JSValueRef global_execute(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exc) @@ -2492,6 +2498,7 @@ create_global_object() JSStaticValue global_values[] = { { "global", global_get, NULL, kJSDefaultAttributes }, + { "webkitSession", global_get_webkit_session, NULL, kJSDefaultAttributes }, { 0, 0, 0, 0 }, }; @@ -2723,6 +2730,9 @@ create_global_object() s_download_class = JSClassCreate(&cd); s_constructors[CONSTRUCTOR_DOWNLOAD] = create_constructor(s_global_context, "Download", s_download_class, download_constructor_cb, NULL); + + s_soup_session = make_object_for_class(s_global_context, s_gobject_class, G_OBJECT(webkit_get_default_session()), false); + JSValueProtect(s_global_context, s_soup_session); }/*}}}*/ /*}}}*/ @@ -2925,6 +2935,7 @@ scripts_end() JSValueUnprotect(s_global_context, s_array_contructor); JSValueUnprotect(s_global_context, UNDEFINED); JSValueUnprotect(s_global_context, NIL); + JSValueUnprotect(s_global_context, s_soup_session); JSClassRelease(s_gobject_class); JSClassRelease(s_webview_class); JSClassRelease(s_frame_class); |