diff options
-rw-r--r-- | vapi/Makefile.am | 5 | ||||
-rw-r--r-- | vapi/javascriptcoregtk-4.0.vapi | 150 | ||||
-rw-r--r-- | vapi/metadata/JavaScriptCore-4.0-custom.vala | 158 | ||||
-rw-r--r-- | vapi/metadata/JavaScriptCore-4.0.metadata | 4 | ||||
-rw-r--r-- | vapi/metadata/WebKit2-4.0.metadata | 11 | ||||
-rw-r--r-- | vapi/metadata/WebKit2WebExtension-4.0.metadata | 2 | ||||
-rw-r--r-- | vapi/webkit2gtk-4.0.deps | 1 | ||||
-rw-r--r-- | vapi/webkit2gtk-4.0.vapi | 3 | ||||
-rw-r--r-- | vapi/webkit2gtk-web-extension-4.0.deps | 1 | ||||
-rw-r--r-- | vapi/webkit2gtk-web-extension-4.0.vapi | 4 |
10 files changed, 328 insertions, 11 deletions
diff --git a/vapi/Makefile.am b/vapi/Makefile.am index 1f5c2b2bd..fef7826a6 100644 --- a/vapi/Makefile.am +++ b/vapi/Makefile.am @@ -188,6 +188,7 @@ dist_vapi_DATA = \ hildon-1.vapi \ hildon-fm-2.deps \ hildon-fm-2.vapi \ + javascriptcoregtk-4.0.vapi \ json-glib-1.0.deps \ json-glib-1.0.vapi \ libarchive.deps \ @@ -436,6 +437,7 @@ GIR_BINDINGS = \ graphene-1.0 \ gtk+-4.0 \ gudev-1.0 \ + javascriptcoregtk-4.0 \ json-glib-1.0 \ libgdata \ libgnome-menu-3.0 \ @@ -732,6 +734,9 @@ hildon-1: hildon-fm-2: $(GENVAPI) --library $(srcdir)/hildon-fm-2 $(PACKAGESDIR)/hildon-fm-2/hildon-fm-2.gi +javascriptcoregtk-4.0: + $(GENVAPI) --library $(srcdir)/javascriptcoregtk-4.0 --metadatadir $(METADATADIR) $(METADATADIR)/JavaScriptCore-4.0-custom.vala $(GIRDIR)/JavaScriptCore-4.0.gir + json-glib-1.0: $(GENVAPI) --library $(srcdir)/json-glib-1.0 --metadatadir $(METADATADIR) --pkg gio-2.0 $(METADATADIR)/Json-1.0-custom.vala $(GIRDIR)/Json-1.0.gir diff --git a/vapi/javascriptcoregtk-4.0.vapi b/vapi/javascriptcoregtk-4.0.vapi new file mode 100644 index 000000000..c937cae11 --- /dev/null +++ b/vapi/javascriptcoregtk-4.0.vapi @@ -0,0 +1,150 @@ +/* javascriptcoregtk-4.0.vapi generated by vapigen, do not modify. */ + +[CCode (cprefix = "JS", gir_namespace = "JavaScriptCore", gir_version = "4.0", lower_case_cprefix = "JS_")] +namespace JS { + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "void", free_function = "JSClassRelease", has_type_id = false)] + [Compact] + public class Class { + [CCode (cname = "JSClassRelease")] + [DestroysInstance] + public void release (); + [CCode (cname = "JSClassRetain")] + public JS.Class retain (); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "const struct OpaqueJSContext", free_function = "", has_type_id = false)] + [Compact] + public class Context { + [CCode (cname = "JSCheckScriptSyntax")] + public bool check_script_syntax (JS.String script, JS.String? source_url = null, int starting_line_number = 1, out JS.Value? exception = null); + [CCode (cname = "JSGarbageCollect")] + public void collect_garbage (); + [CCode (cname = "JSEvaluateScript")] + public unowned JS.Value? evaluate_script (JS.String script, JS.Object? this_object = null, JS.String? source_url = null, int starting_line_number = 1, out JS.Value? exception = null); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSContext", free_function = "JSGlobalContextRelease", has_type_id = false)] + [Compact] + public class GlobalContext : JS.Context { + [CCode (cname = "JSGlobalContextCreate")] + public GlobalContext (JS.Class? global_object_class = null); + [CCode (cname = "JSGlobalContextRelease")] + [DestroysInstance] + public void release (); + [CCode (cname = "JSGlobalContextRetain")] + public JS.GlobalContext retain (); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSValue", free_function = "", has_type_id = false)] + [Compact] + public class Object { + [CCode (cname = "JSObjectCallAsFunction", instance_pos = 1.1)] + public JS.Value call_as_function (JS.Context ctx, JS.Object? this_object, [CCode (array_length_pos = 2.5)] JS.Value[]? arguments, out JS.Value? exception); + [CCode (cname = "JSObjectGetProperty", instance_pos = 1.1)] + public JS.Value get_property (JS.Context ctx, JS.String property_name, out JS.Value? exception); + [CCode (cname = "JSObjectHasProperty", instance_pos = 1.1)] + public bool has_property (JS.Context ctx, JS.String property_name); + [CCode (cname = "JSObjectMakeFunction")] + public Object.make_function (JS.String? name, [CCode (array_length_pos = 1.5)] JS.String[]? parameter_names, JS.String body, JS.String? source_url, int starting_line_number, out JS.Value? exception); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSString", free_function = "JSStringRelease", has_type_id = false)] + [Compact] + public class String { + [CCode (cname = "JSStringCreateWithUTF8CString")] + public String.create_with_utf8_cstring (string str); + [CCode (cname = "JSStringGetLength")] + public size_t get_length (); + [CCode (cname = "JSStringGetMaximumUTF8CStringSize")] + public size_t get_maximum_utf8_cstring_size (); + [CCode (cname = "JSStringGetUTF8CString")] + public size_t get_utf8_cstring ([CCode (array_length_type = "gsize")] ref uint8[] buffer); + [CCode (cname = "JSStringIsEqual")] + public bool is_equal (JS.String b); + [CCode (cname = "JSStringIsEqualToUTF8CString")] + public bool is_equal_to_utf8_cstring (string b); + [CCode (cname = "JSStringRelease")] + [DestroysInstance] + public void release (); + [CCode (cname = "JSStringRetain")] + public JS.String retain (); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "const struct OpaqueJSValue", free_function = "", has_type_id = false)] + [Compact] + public class Value { + [CCode (cname = "JSValueGetType", instance_pos = 1.1)] + public JS.Type get_type (JS.Context ctx); + [CCode (cname = "JSValueGetTypedArrayType", instance_pos = 1.1)] + public JS.TypedArrayType get_typed_array_type (JS.Context ctx); + [CCode (cname = "JSValueIsArray", instance_pos = 1.1)] + public bool is_array (JS.Context ctx); + [CCode (cname = "JSValueIsBoolean", instance_pos = 1.1)] + public bool is_boolean (JS.Context ctx); + [CCode (cname = "JSValueIsDate", instance_pos = 1.1)] + public bool is_date (JS.Context ctx); + [CCode (cname = "JSValueIsEqual", instance_pos = 1.1)] + public bool is_equal (JS.Context ctx, JS.Value b, out JS.Value? exception = null); + [CCode (cname = "JSValueIsNull", instance_pos = 1.1)] + public bool is_null (JS.Context ctx); + [CCode (cname = "JSValueIsNumber", instance_pos = 1.1)] + public bool is_number (JS.Context ctx); + [CCode (cname = "JSValueIsObject", instance_pos = 1.1)] + public bool is_object (JS.Context ctx); + [CCode (cname = "JSValueIsObjectOfClass", instance_pos = 1.1)] + public bool is_object_of_class (JS.Context ctx, JS.Class js_class); + [CCode (cname = "JSValueIsStrictEqual", instance_pos = 1.1)] + public bool is_strict_equal (JS.Context ctx, JS.Value b); + [CCode (cname = "JSValueIsString", instance_pos = 1.1)] + public bool is_string (JS.Context ctx); + [CCode (cname = "JSValueIsUndefined", instance_pos = 1.1)] + public bool is_undefined (JS.Context ctx); + [CCode (cname = "JSValueProtect", instance_pos = 1.1)] + public void protect (JS.Context ctx); + [CCode (cname = "JSValueToBoolean", instance_pos = 1.1)] + public bool to_boolean (JS.Context ctx); + [CCode (cname = "JSValueToNumber", instance_pos = 1.1)] + public double to_number (JS.Context ctx, out JS.Value? exception = null); + [CCode (cname = "JSValueToObject", instance_pos = 1.1)] + public JS.Object to_object (JS.Context ctx, out JS.Value? exception = null); + [CCode (cname = "JSValueToStringCopy", instance_pos = 1.1)] + public JS.String to_string_copy (JS.Context ctx, out JS.Value? exception = null); + [CCode (cname = "JSValueUnprotect", instance_pos = 1.1)] + public void unprotect (JS.Context ctx); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "JSType", has_type_id = false)] + public enum Type { + [CCode (cname = "kJSTypeUndefined")] + UNDEFINED, + [CCode (cname = "kJSTypeNull")] + NULL, + [CCode (cname = "kJSTypeBoolean")] + BOOLEAN, + [CCode (cname = "kJSTypeNumber")] + NUMBER, + [CCode (cname = "kJSTypeString")] + STRING, + [CCode (cname = "kJSTypeObject")] + OBJECT + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "JSTypedArrayType", has_type_id = false)] + public enum TypedArrayType { + [CCode (cname = "kJSTypedArrayTypeInt8Array")] + INT8, + [CCode (cname = "kJSTypedArrayTypeInt16Array")] + INT16, + [CCode (cname = "kJSTypedArrayTypeInt32Array")] + INT32, + [CCode (cname = "kJSTypedArrayTypeUint8Array")] + UINT8, + [CCode (cname = "kJSTypedArrayTypeUint8ClampedArray")] + UINT8_CLAMPED, + [CCode (cname = "kJSTypedArrayTypeUint16Array")] + UINT16, + [CCode (cname = "kJSTypedArrayTypeUint32Array")] + UINT32, + [CCode (cname = "kJSTypedArrayTypeFloat32Array")] + FLOAT32, + [CCode (cname = "kJSTypedArrayTypeFloat64Array")] + FLOAT64, + [CCode (cname = "kJSTypedArrayTypeArrayBuffer")] + BUFFER, + [CCode (cname = "kJSTypedArrayTypeNone")] + NONE + } +} diff --git a/vapi/metadata/JavaScriptCore-4.0-custom.vala b/vapi/metadata/JavaScriptCore-4.0-custom.vala new file mode 100644 index 000000000..2a1125fd3 --- /dev/null +++ b/vapi/metadata/JavaScriptCore-4.0-custom.vala @@ -0,0 +1,158 @@ +/** + * Based on the work by + * Copyright 2011 Jiří Janoušek <janousek.jiri@gmail.com> + * Copyright 2017 Michael Gratton <mike@vee.net> + */ +[CCode (cprefix = "JS", gir_namespace = "JavaScriptCore", gir_version = "4.0", lower_case_cprefix = "JS_")] +namespace JS { + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "void", free_function = "JSClassRelease", has_type_id = false)] + [Compact] + public class Class { + [CCode (cname = "JSClassRetain")] + public JS.Class retain (); + [CCode (cname = "JSClassRelease")] + [DestroysInstance] + public void release (); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "const struct OpaqueJSContext", free_function = "", has_type_id = false)] + [Compact] + public class Context { + [CCode (cname = "JSCheckScriptSyntax")] + public bool check_script_syntax (JS.String script, JS.String? source_url = null, int starting_line_number = 1, out JS.Value? exception = null); + [CCode (cname = "JSGarbageCollect")] + public void collect_garbage (); + [CCode (cname = "JSEvaluateScript")] + public unowned JS.Value? evaluate_script (JS.String script, JS.Object? this_object = null, JS.String? source_url = null, int starting_line_number = 1, out JS.Value? exception = null); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSContext", free_function = "JSGlobalContextRelease", has_type_id = false)] + [Compact] + public class GlobalContext : JS.Context { + [CCode (cname = "JSGlobalContextCreate")] + public GlobalContext (JS.Class? global_object_class = null); + [CCode (cname = "JSGlobalContextRelease")] + [DestroysInstance] + public void release (); + [CCode (cname = "JSGlobalContextRetain")] + public JS.GlobalContext retain (); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSValue", free_function = "", has_type_id = false)] + [Compact] + public class Object { + [CCode (cname = "JSObjectCallAsFunction", instance_pos = 1.1)] + public JS.Value call_as_function (JS.Context ctx, JS.Object? this_object, [CCode (array_length_pos = 2.5)] JS.Value[]? arguments, out JS.Value? exception); + [CCode (cname = "JSObjectGetProperty", instance_pos = 1.1)] + public JS.Value get_property (JS.Context ctx, JS.String property_name, out JS.Value? exception); + [CCode (cname = "JSObjectHasProperty", instance_pos = 1.1)] + public bool has_property (JS.Context ctx, JS.String property_name); + [CCode (cname = "JSObjectMakeFunction")] + public Object.make_function (JS.String? name, [CCode (array_length_pos = 1.5)] JS.String[]? parameter_names, JS.String body, JS.String? source_url, int starting_line_number, out JS.Value? exception); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSString", free_function = "JSStringRelease", has_type_id = false)] + [Compact] + public class String { + [CCode (cname = "JSStringCreateWithUTF8CString")] + public String.create_with_utf8_cstring (string str); + [CCode (cname = "JSStringGetLength")] + public size_t get_length (); + [CCode (cname = "JSStringGetMaximumUTF8CStringSize")] + public size_t get_maximum_utf8_cstring_size (); + [CCode (cname = "JSStringGetUTF8CString")] + public size_t get_utf8_cstring ([CCode (array_length_type = "gsize")] ref uint8[] buffer); + [CCode (cname = "JSStringIsEqual")] + public bool is_equal (JS.String b); + [CCode (cname = "JSStringIsEqualToUTF8CString")] + public bool is_equal_to_utf8_cstring (string b); + [CCode (cname = "JSStringRelease")] + [DestroysInstance] + public void release (); + [CCode (cname = "JSStringRetain")] + public JS.String retain (); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "const struct OpaqueJSValue", free_function = "", has_type_id = false)] + [Compact] + public class Value { + [CCode (cname = "JSValueGetType", instance_pos = 1.1)] + public JS.Type get_type (JS.Context ctx); + + [CCode (cname = "JSValueGetTypedArrayType", instance_pos = 1.1)] + public JS.TypedArrayType get_typed_array_type (JS.Context ctx); + + [CCode (cname = "JSValueIsArray", instance_pos = 1.1)] + public bool is_array (JS.Context ctx); + [CCode (cname = "JSValueIsBoolean", instance_pos = 1.1)] + public bool is_boolean (JS.Context ctx); + [CCode (cname = "JSValueIsDate", instance_pos = 1.1)] + public bool is_date (JS.Context ctx); + [CCode (cname = "JSValueIsNumber", instance_pos = 1.1)] + public bool is_number (JS.Context ctx); + [CCode (cname = "JSValueIsObject", instance_pos = 1.1)] + public bool is_object (JS.Context ctx); + [CCode (cname = "JSValueIsObjectOfClass", instance_pos = 1.1)] + public bool is_object_of_class (JS.Context ctx, JS.Class js_class); + [CCode (cname = "JSValueIsString", instance_pos = 1.1)] + public bool is_string (JS.Context ctx); + [CCode (cname = "JSValueIsUndefined", instance_pos = 1.1)] + public bool is_undefined (JS.Context ctx); + [CCode (cname = "JSValueIsNull", instance_pos = 1.1)] + public bool is_null (JS.Context ctx); + + [CCode (cname = "JSValueIsEqual", instance_pos = 1.1)] + public bool is_equal (JS.Context ctx, JS.Value b, out JS.Value? exception = null); + [CCode (cname = "JSValueIsStrictEqual", instance_pos = 1.1)] + public bool is_strict_equal (JS.Context ctx, JS.Value b); + + [CCode (cname = "JSValueToBoolean", instance_pos = 1.1)] + public bool to_boolean (JS.Context ctx); + [CCode (cname = "JSValueToNumber", instance_pos = 1.1)] + public double to_number (JS.Context ctx, out JS.Value? exception = null); + [CCode (cname = "JSValueToObject", instance_pos = 1.1)] + public JS.Object to_object (JS.Context ctx, out JS.Value? exception = null); + [CCode (cname = "JSValueToStringCopy", instance_pos = 1.1)] + public JS.String to_string_copy (JS.Context ctx, out JS.Value? exception = null); + + [CCode (cname = "JSValueProtect", instance_pos = 1.1)] + public void protect (JS.Context ctx); + [CCode (cname = "JSValueUnprotect", instance_pos = 1.1)] + public void unprotect (JS.Context ctx); + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "JSType", has_type_id = false)] + public enum Type { + [CCode (cname = "kJSTypeUndefined")] + UNDEFINED, + [CCode (cname = "kJSTypeNull")] + NULL, + [CCode (cname = "kJSTypeBoolean")] + BOOLEAN, + [CCode (cname = "kJSTypeNumber")] + NUMBER, + [CCode (cname = "kJSTypeString")] + STRING, + [CCode (cname = "kJSTypeObject")] + OBJECT + } + [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "JSTypedArrayType", has_type_id = false)] + public enum TypedArrayType { + [CCode (cname = "kJSTypedArrayTypeInt8Array")] + INT8, + [CCode (cname = "kJSTypedArrayTypeInt16Array")] + INT16, + [CCode (cname = "kJSTypedArrayTypeInt32Array")] + INT32, + [CCode (cname = "kJSTypedArrayTypeUint8Array")] + UINT8, + [CCode (cname = "kJSTypedArrayTypeUint8ClampedArray")] + UINT8_CLAMPED, + [CCode (cname = "kJSTypedArrayTypeUint16Array")] + UINT16, + [CCode (cname = "kJSTypedArrayTypeUint32Array")] + UINT32, + [CCode (cname = "kJSTypedArrayTypeFloat32Array")] + FLOAT32, + [CCode (cname = "kJSTypedArrayTypeFloat64Array")] + FLOAT64, + [CCode (cname = "kJSTypedArrayTypeArrayBuffer")] + BUFFER, + [CCode (cname = "kJSTypedArrayTypeNone")] + NONE + } +} diff --git a/vapi/metadata/JavaScriptCore-4.0.metadata b/vapi/metadata/JavaScriptCore-4.0.metadata new file mode 100644 index 000000000..a153955d5 --- /dev/null +++ b/vapi/metadata/JavaScriptCore-4.0.metadata @@ -0,0 +1,4 @@ +* cheader_filename="JavaScriptCore/JavaScript.h" + +GlobalContext struct=false +Value struct=false diff --git a/vapi/metadata/WebKit2-4.0.metadata b/vapi/metadata/WebKit2-4.0.metadata index 1b6b61bff..0c43ed5bd 100644 --- a/vapi/metadata/WebKit2-4.0.metadata +++ b/vapi/metadata/WebKit2-4.0.metadata @@ -1,18 +1,15 @@ -// Skip functions which require JavaScriptCore until a VAPI is written -JavascriptResult - .get_global_context skip - .get_value skip -WebView - .get_javascript_global_context skip - //Forward upstream Download .failed#signal.error type="WebKit.DownloadError" +JavascriptResult + .get_global_context unowned + .get_value unowned PrintOperation .failed#signal.error type="WebKit.PrintError" WebResource .failed#signal.error type="GLib.Error" WebView + .get_javascript_global_context unowned .load_failed#signal.error type="GLib.Error" .show_option_menu#signal name="on_show_option_menu" diff --git a/vapi/metadata/WebKit2WebExtension-4.0.metadata b/vapi/metadata/WebKit2WebExtension-4.0.metadata index 3fe3c186f..fc55a16a2 100644 --- a/vapi/metadata/WebKit2WebExtension-4.0.metadata +++ b/vapi/metadata/WebKit2WebExtension-4.0.metadata @@ -4,8 +4,6 @@ DOMEventTarget.add_event_listener skip _ContextMenu skip _ContextMenuItem skip -Frame.get_javascript_* type="void*" - DOMEventTarget.add_event_listener_with_closure.handler type="owned WebKit.DOM.EventTargetFunc" URIRequest.get_http_headers unowned diff --git a/vapi/webkit2gtk-4.0.deps b/vapi/webkit2gtk-4.0.deps index 2868ee0cd..2d6386b48 100644 --- a/vapi/webkit2gtk-4.0.deps +++ b/vapi/webkit2gtk-4.0.deps @@ -1,2 +1,3 @@ gtk+-3.0 +javascriptcoregtk-4.0 libsoup-2.4 diff --git a/vapi/webkit2gtk-4.0.vapi b/vapi/webkit2gtk-4.0.vapi index a4ff618bc..a248675a3 100644 --- a/vapi/webkit2gtk-4.0.vapi +++ b/vapi/webkit2gtk-4.0.vapi @@ -320,6 +320,8 @@ namespace WebKit { [CCode (cheader_filename = "webkit2/webkit2.h", ref_function = "webkit_javascript_result_ref", type_id = "webkit_javascript_result_get_type ()", unref_function = "webkit_javascript_result_unref")] [Compact] public class JavascriptResult { + public unowned JS.GlobalContext get_global_context (); + public unowned JS.Value get_value (); public unowned WebKit.JavascriptResult @ref (); public void unref (); } @@ -989,6 +991,7 @@ namespace WebKit { public unowned Cairo.Surface get_favicon (); public unowned WebKit.FindController get_find_controller (); public unowned WebKit.WebInspector get_inspector (); + public unowned JS.GlobalContext get_javascript_global_context (); public unowned WebKit.WebResource get_main_resource (); public uint64 get_page_id (); [Version (since = "2.12")] diff --git a/vapi/webkit2gtk-web-extension-4.0.deps b/vapi/webkit2gtk-web-extension-4.0.deps index 2868ee0cd..2d6386b48 100644 --- a/vapi/webkit2gtk-web-extension-4.0.deps +++ b/vapi/webkit2gtk-web-extension-4.0.deps @@ -1,2 +1,3 @@ gtk+-3.0 +javascriptcoregtk-4.0 libsoup-2.4 diff --git a/vapi/webkit2gtk-web-extension-4.0.vapi b/vapi/webkit2gtk-web-extension-4.0.vapi index 2b124c7df..1c2d4b0dd 100644 --- a/vapi/webkit2gtk-web-extension-4.0.vapi +++ b/vapi/webkit2gtk-web-extension-4.0.vapi @@ -2916,9 +2916,9 @@ namespace WebKit { [CCode (has_construct_function = false)] protected Frame (); [Version (since = "2.2")] - public void* get_javascript_context_for_script_world (WebKit.ScriptWorld world); + public unowned JS.GlobalContext get_javascript_context_for_script_world (WebKit.ScriptWorld world); [Version (since = "2.2")] - public void* get_javascript_global_context (); + public unowned JS.GlobalContext get_javascript_global_context (); [Version (since = "2.2")] public unowned string get_uri (); [Version (since = "2.2")] |