diff options
Diffstat (limited to 'src/scripts.c')
-rw-r--r-- | src/scripts.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/scripts.c b/src/scripts.c index f3989656..b23868e9 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -97,6 +97,7 @@ static Sigmap s_sigmap[] = { { SCRIPTS_SIG_STATUS_BAR, "statusBarChange" }, { SCRIPTS_SIG_TAB_BUTTON_PRESS, "tabButtonPress" }, { SCRIPTS_SIG_CHANGE_MODE, "changeMode" }, + { SCRIPTS_SIG_EXECUTE_COMMAND, "executeCommand" }, { 0, NULL }, }; @@ -129,6 +130,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 +881,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 +2499,7 @@ create_global_object() JSStaticValue global_values[] = { { "global", global_get, NULL, kJSDefaultAttributes }, + { "session", global_get_webkit_session, NULL, kJSDefaultAttributes }, { 0, 0, 0, 0 }, }; @@ -2723,6 +2731,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 +2936,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); |