Date: Tue, 13 Nov 2018 17:38:52 +0000 (UTC) From: Koop Mast <kwm@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r484881 - in head/mail/geary: . files Message-ID: <201811131738.wADHcqqg097500@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kwm Date: Tue Nov 13 17:38:52 2018 New Revision: 484881 URL: https://svnweb.freebsd.org/changeset/ports/484881 Log: Update geary to 0.12.4. * Add patches the fix the build with webkit2-gtk3 2.22 and vala 0.40.11. Obtained from: upstream Added: head/mail/geary/files/ head/mail/geary/files/patch-0d96695 (contents, props changed) head/mail/geary/files/patch-5d0f711 (contents, props changed) head/mail/geary/files/patch-e091f24 (contents, props changed) Modified: head/mail/geary/Makefile head/mail/geary/distinfo Modified: head/mail/geary/Makefile ============================================================================== --- head/mail/geary/Makefile Tue Nov 13 17:37:23 2018 (r484880) +++ head/mail/geary/Makefile Tue Nov 13 17:38:52 2018 (r484881) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= geary -PORTVERSION= 0.12.2 +PORTVERSION= 0.12.4 CATEGORIES= mail gnome MASTER_SITES= GNOME DIST_SUBDIR= gnome3 @@ -27,7 +27,7 @@ LIB_DEPENDS= libgmime-2.6.so:mail/gmime26 \ libsoup-2.4.so:devel/libsoup \ libenchant.so:textproc/enchant -USES= cmake:outsource compiler:c11 desktop-file-utils gettext libtool \ +USES= cmake:outsource compiler:c11 desktop-file-utils gettext gnome libtool \ localbase:ldflags pkgconfig shebangfix sqlite tar:xz USE_GNOME= cairo gnomedocutils gnomeprefix gtk30 intlhack introspection SHEBANG_FILES= desktop/geary-attach Modified: head/mail/geary/distinfo ============================================================================== --- head/mail/geary/distinfo Tue Nov 13 17:37:23 2018 (r484880) +++ head/mail/geary/distinfo Tue Nov 13 17:38:52 2018 (r484881) @@ -1,3 +1,3 @@ -TIMESTAMP = 1525760008 -SHA256 (gnome3/geary-0.12.2.tar.xz) = a9ef2889cf90a44462c374308eef7539193e6703c06fe6c5632e91fa097c4526 -SIZE (gnome3/geary-0.12.2.tar.xz) = 1068428 +TIMESTAMP = 1542129202 +SHA256 (gnome3/geary-0.12.4.tar.xz) = b5224cb3f07d6856acc67b3242785c115fa1bba1f9677267823bdfe9e484d307 +SIZE (gnome3/geary-0.12.4.tar.xz) = 1070368 Added: head/mail/geary/files/patch-0d96695 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/geary/files/patch-0d96695 Tue Nov 13 17:38:52 2018 (r484881) @@ -0,0 +1,190 @@ +https://gitlab.gnome.org/GNOME/geary/issues/37 + +From 0d966950a2cba888873cd3a7f4f42bb7a017dc6d Mon Sep 17 00:00:00 2001 +From: Rico Tzschichholz <ricotz@ubuntu.com> +Date: Mon, 23 Apr 2018 19:56:18 +0200 +Subject: [PATCH] Adjust to upstream javascriptcore-4.0 bindings + +--- + .../conversation-web-view.vala | 2 +- + src/client/util/util-webkit.vala | 10 +++---- + .../web-process/web-process-extension.vala | 17 ++++------- + src/engine/util/util-js.vala | 30 +++++++++++++------ + 4 files changed, 33 insertions(+), 26 deletions(-) + +diff --git a/src/client/conversation-viewer/conversation-web-view.vala b/src/client/conversation-viewer/conversation-web-view.vala +index 588d39bd..d8512355 100644 +--- src/client/conversation-viewer/conversation-web-view.vala ++++ src/client/conversation-viewer/conversation-web-view.vala +@@ -183,7 +183,7 @@ public class ConversationWebView : ClientWebView { + + private void on_deceptive_link_clicked(WebKit.JavascriptResult result) { + try { +- JS.GlobalContext context = result.get_global_context(); ++ unowned JS.GlobalContext context = result.get_global_context(); + JS.Object details = WebKitUtil.to_object(result); + + uint reason = (uint) Geary.JS.to_number( +diff --git a/src/client/util/util-webkit.vala b/src/client/util/util-webkit.vala +index 319e28ad..cba9eaf2 100644 +--- src/client/util/util-webkit.vala ++++ src/client/util/util-webkit.vala +@@ -18,8 +18,8 @@ namespace WebKitUtil { + */ + public bool to_bool(WebKit.JavascriptResult result) + throws Geary.JS.Error { +- JS.GlobalContext context = result.get_global_context(); +- JS.Value value = result.get_value(); ++ unowned JS.GlobalContext context = result.get_global_context(); ++ unowned JS.Value value = result.get_value(); + if (!value.is_boolean(context)) { + throw new Geary.JS.Error.TYPE("Result is not a JS Boolean object"); + } +@@ -59,12 +59,12 @@ namespace WebKitUtil { + */ + public string as_string(WebKit.JavascriptResult result) + throws Geary.JS.Error { +- JS.GlobalContext context = result.get_global_context(); +- JS.Value js_str_value = result.get_value(); ++ unowned JS.GlobalContext context = result.get_global_context(); ++ unowned JS.Value js_str_value = result.get_value(); + JS.Value? err = null; + JS.String js_str = js_str_value.to_string_copy(context, out err); + Geary.JS.check_exception(context, err); +- return Geary.JS.to_string_released(js_str); ++ return Geary.JS.to_string_released((owned) js_str); + } + + /** +diff --git a/src/client/web-process/web-process-extension.vala b/src/client/web-process/web-process-extension.vala +index ee89139d..1f478a6c 100644 +--- src/client/web-process/web-process-extension.vala ++++ src/client/web-process/web-process-extension.vala +@@ -87,10 +87,9 @@ public class GearyWebExtension : Object { + bool should_load = false; + WebKit.Frame frame = page.get_main_frame(); + // Explicit cast fixes build on s390x/ppc64. Bug 783882 +- JS.GlobalContext context = (JS.GlobalContext) +- frame.get_javascript_global_context(); ++ unowned JS.GlobalContext context = frame.get_javascript_global_context(); + try { +- JS.Value ret = execute_script( ++ unowned JS.Value ret = execute_script( + context, "geary.allowRemoteImages", int.parse("__LINE__") + ); + should_load = ret.to_boolean(context); +@@ -106,8 +105,7 @@ public class GearyWebExtension : Object { + private void remote_image_load_blocked(WebKit.WebPage page) { + WebKit.Frame frame = page.get_main_frame(); + // Explicit cast fixes build on s390x/ppc64. Bug 783882 +- JS.GlobalContext context = (JS.GlobalContext) +- frame.get_javascript_global_context(); ++ unowned JS.GlobalContext context = frame.get_javascript_global_context(); + try { + execute_script( + context, "geary.remoteImageLoadBlocked();", int.parse("__LINE__") +@@ -123,8 +121,7 @@ public class GearyWebExtension : Object { + private void selection_changed(WebKit.WebPage page) { + WebKit.Frame frame = page.get_main_frame(); + // Explicit cast fixes build on s390x/ppc64. Bug 783882 +- JS.GlobalContext context = (JS.GlobalContext) +- frame.get_javascript_global_context(); ++ unowned JS.GlobalContext context = frame.get_javascript_global_context(); + try { + execute_script( + context, "geary.selectionChanged();", int.parse("__LINE__") +@@ -136,20 +133,18 @@ public class GearyWebExtension : Object { + + // Return type is nullable as a workaround for Bug 778046, it will + // never actually be null. +- private JS.Value? execute_script(JS.Context context, string script, int line) ++ private unowned JS.Value? execute_script(JS.Context context, string script, int line) + throws Geary.JS.Error { + JS.String js_script = new JS.String.create_with_utf8_cstring(script); + JS.String js_source = new JS.String.create_with_utf8_cstring("__FILE__"); + JS.Value? err = null; + try { +- JS.Value ret = context.evaluate_script( ++ unowned JS.Value ret = context.evaluate_script( + js_script, null, js_source, line, out err + ); + Geary.JS.check_exception(context, err); + return ret; + } finally { +- js_script.release(); +- js_source.release(); + } + } + +diff --git a/src/engine/util/util-js.vala b/src/engine/util/util-js.vala +index 4d224297..ea955e99 100644 +--- src/engine/util/util-js.vala ++++ src/engine/util/util-js.vala +@@ -10,6 +10,16 @@ + */ + namespace Geary.JS { + ++#if !VALA_0_42 ++ // Workaround broken version of this in the vala bindings. See Bug ++ // 788113. ++ [CCode (cname = "JSStringGetUTF8CString")] ++ private extern size_t js_string_get_utf8_cstring( ++ global::JS.String js, ++ [CCode (array_length_type = "gsize")] char[] buffer ++ ); ++#endif ++ + /** + * Errors produced by functions in {@link Geary.JS}. + */ +@@ -72,7 +82,7 @@ namespace Geary.JS { + global::JS.String js_str = value.to_string_copy(context, out err); + Geary.JS.check_exception(context, err); + +- return Geary.JS.to_string_released(js_str); ++ return Geary.JS.to_string_released((owned) js_str); + } + + /** +@@ -101,12 +111,15 @@ namespace Geary.JS { + /** + * Returns a JSC {@link JS.String} as a Vala {@link string}. + */ +- public inline string to_string_released(global::JS.String js) { +- int len = js.get_maximum_utf8_cstring_size(); +- string str = string.nfill(len, 0); +- js.get_utf8_cstring(str, len); +- js.release(); +- return str; ++ public inline string to_string_released(owned global::JS.String js) { ++ size_t len = js.get_maximum_utf8_cstring_size(); ++ uint8[] str = new uint8[len]; ++#if VALA_0_42 ++ js.get_utf8_cstring(str); ++#else ++ js_string_get_utf8_cstring(js, (char[]) str); ++#endif ++ return (string) str; + } + + /** +@@ -128,7 +141,6 @@ namespace Geary.JS { + try { + Geary.JS.check_exception(context, err); + } finally { +- js_name.release(); + } + return prop; + } +@@ -157,7 +169,7 @@ namespace Geary.JS { + + throw new Error.EXCEPTION( + "JS exception thrown [%s]: %s" +- .printf(err_type.to_string(), to_string_released(err_str)) ++ .printf(err_type.to_string(), to_string_released((owned) err_str)) + ); + } + } +-- +2.18.1 + Added: head/mail/geary/files/patch-5d0f711 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/geary/files/patch-5d0f711 Tue Nov 13 17:38:52 2018 (r484881) @@ -0,0 +1,334 @@ +https://gitlab.gnome.org/GNOME/geary/issues/37 + +From 5d0f711426d76f878cf9b71f7e8f785199c7cde1 Mon Sep 17 00:00:00 2001 +From: Rico Tzschichholz <ricotz@ubuntu.com> +Date: Thu, 22 Jun 2017 15:01:19 +0200 +Subject: [PATCH] bindings: Drop custom javascriptcore-4.0 and webkit2gtk-4.0 + vapi + +--- + bindings/metadata/Soup-2.4.metadata | 3 - + bindings/metadata/WebKit2-4.0.metadata | 15 -- + .../WebKit2WebExtension-4.0-custom.vala | 5 - + .../metadata/WebKit2WebExtension-4.0.metadata | 9 - + bindings/vapi/javascriptcore-4.0.vapi | 155 ------------------ + src/CMakeLists.txt | 39 +---- + test/CMakeLists.txt | 2 +- + 7 files changed, 4 insertions(+), 224 deletions(-) + delete mode 100644 bindings/metadata/Soup-2.4.metadata + delete mode 100644 bindings/metadata/WebKit2-4.0.metadata + delete mode 100644 bindings/metadata/WebKit2WebExtension-4.0-custom.vala + delete mode 100644 bindings/metadata/WebKit2WebExtension-4.0.metadata + delete mode 100644 bindings/vapi/javascriptcore-4.0.vapi + +diff --git a/bindings/metadata/Soup-2.4.metadata b/bindings/metadata/Soup-2.4.metadata +deleted file mode 100644 +index f3e72e81..00000000 +--- bindings/metadata/Soup-2.4.metadata ++++ /dev/null +@@ -1,3 +0,0 @@ +-AuthDomain.accepts skip +-AuthDomain.challenge skip +- +diff --git a/bindings/metadata/WebKit2-4.0.metadata b/bindings/metadata/WebKit2-4.0.metadata +deleted file mode 100644 +index 3e3044ff..00000000 +--- bindings/metadata/WebKit2-4.0.metadata ++++ /dev/null +@@ -1,15 +0,0 @@ +- +-JavascriptResult +- .get_global_context nullable=false unowned=true +- .get_value nullable=false unowned=true +- +-//Forward upstream +-Download +- .failed#signal.error type="WebKit.DownloadError" +-PrintOperation +- .failed#signal.error type="WebKit.PrintError" +-WebResource +- .failed#signal.error type="GLib.Error" +-WebView +- .load_failed#signal.error type="GLib.Error" +- .show_option_menu#signal skip +diff --git a/bindings/metadata/WebKit2WebExtension-4.0-custom.vala b/bindings/metadata/WebKit2WebExtension-4.0-custom.vala +deleted file mode 100644 +index a994a774..00000000 +--- bindings/metadata/WebKit2WebExtension-4.0-custom.vala ++++ /dev/null +@@ -1,5 +0,0 @@ +-namespace WebKit { +- namespace DOM { +- public delegate void EventTargetFunc (WebKit.DOM.EventTarget target, WebKit.DOM.Event event); +- } +-} +diff --git a/bindings/metadata/WebKit2WebExtension-4.0.metadata b/bindings/metadata/WebKit2WebExtension-4.0.metadata +deleted file mode 100644 +index c496dba4..00000000 +--- bindings/metadata/WebKit2WebExtension-4.0.metadata ++++ /dev/null +@@ -1,9 +0,0 @@ +-DOM* parent="WebKit.DOM" name="DOM(.+)" +- +-DOMEventTarget.add_event_listener skip +-_ContextMenu skip +-_ContextMenuItem skip +- +-Frame.get_javascript_* nullable=false unowned=true +- +-DOMEventTarget.add_event_listener_with_closure.handler type="owned WebKit.DOM.EventTargetFunc" +diff --git a/bindings/vapi/javascriptcore-4.0.vapi b/bindings/vapi/javascriptcore-4.0.vapi +deleted file mode 100644 +index d152ce2a..00000000 +--- bindings/vapi/javascriptcore-4.0.vapi ++++ /dev/null +@@ -1,155 +0,0 @@ +-/* +- * Copyright 2017 Michael Gratton <mike@vee.net> +- * +- * This software is licensed under the GNU Lesser General Public License +- * (version 2.1 or later). See the COPYING file in this distribution. +- */ +- +-[CCode (cprefix = "JS", +- gir_namespace = "JavaScriptCore", +- gir_version = "4.0", +- lower_case_cprefix = "JS_", +- cheader_filename = "JavaScriptCore/JavaScript.h")] +-namespace JS { +- +- [CCode (cname = "JSContextRef")] +- [SimpleType] +- public struct Context { +- +- [CCode (cname = "JSEvaluateScript")] +- public Value evaluate_script(String script, +- Object? thisObject, +- String? sourceURL, +- int startingLineNumber, +- out Value? exception); +- +- [CCode (cname = "JSCheckScriptSyntax")] +- public Value check_script_syntax(String script, +- String? sourceURL, +- int startingLineNumber, +- out Value? exception); +- +- } +- +- [CCode (cname = "JSGlobalContextRef")] +- [SimpleType] +- public struct GlobalContext : Context { +- +- [CCode (cname = "JSGlobalContextRetain")] +- public bool retain(); +- +- [CCode (cname = "JSGlobalContextRelease")] +- public bool release(); +- +- } +- +- [CCode (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 (cname = "JSObjectRef")] +- [SimpleType] +- public struct Object { +- +- [CCode (cname = "JSObjectMakeFunction")] +- public Object.make_function(String? name, +- [CCode (array_length_pos=1.5)] +- String[]? parameterNames, +- String body, +- String? sourceURL, +- int startingLineNumber, +- out Value? exception); +- +- [CCode (cname = "JSObjectCallAsFunction", instance_pos = 1.1)] +- public Value call_as_function(Context ctx, +- Object? thisObject, +- [CCode (array_length_pos=2.5)] +- Value[]? arguments, +- out Value? exception); +- +- [CCode (cname = "JSObjectHasProperty", instance_pos = 1.1)] +- public bool has_property(Context ctx, String property_name); +- +- [CCode (cname = "JSObjectGetProperty", instance_pos = 1.1)] +- public Value get_property(Context ctx, +- String property_name, +- out Value? exception); +- +- } +- +- [CCode (cname = "JSValueRef")] +- [SimpleType] +- public struct Value { +- +- [CCode (cname = "JSValueGetType", instance_pos = 1.1)] +- public Type get_type(Context context); +- +- [CCode (cname = "JSValueIsBoolean", instance_pos = 1.1)] +- public bool is_boolean(Context ctx); +- +- [CCode (cname = "JSValueIsNumber", instance_pos = 1.1)] +- public bool is_number(Context ctx); +- +- [CCode (cname = "JSValueIsObject", instance_pos = 1.1)] +- public bool is_object(Context ctx); +- +- [CCode (cname = "JSValueIsString", instance_pos = 1.1)] +- public bool is_string(Context ctx); +- +- [CCode (cname = "JSValueToBoolean", instance_pos = 1.1)] +- public bool to_boolean(Context ctx); +- +- [CCode (cname = "JSValueToNumber", instance_pos = 1.1)] +- public double to_number(Context ctx, out Value exception); +- +- [CCode (cname = "JSValueToObject", instance_pos = 1.1)] +- public Object to_object(Context ctx, out Value exception); +- +- [CCode (cname = "JSValueToStringCopy", instance_pos = 1.1)] +- public String to_string_copy(Context ctx, out Value exception); +- +- } +- +- [CCode (cname = "JSStringRef")] +- [SimpleType] +- public struct String { +- +- [CCode (cname = "JSStringCreateWithUTF8CString")] +- public String.create_with_utf8_cstring(string str); +- +- [CCode (cname = "JSStringGetLength")] +- public int String.get_length(); +- +- [CCode (cname = "JSStringGetMaximumUTF8CStringSize")] +- public int String.get_maximum_utf8_cstring_size(); +- +- [CCode (cname = "JSStringGetUTF8CString")] +- public void String.get_utf8_cstring(string* buffer, int bufferSize); +- +- [CCode (cname = "JSStringRetain")] +- public void String.retain(); +- +- [CCode (cname = "JSStringRelease")] +- public void String.release(); +- +- } +- +-} +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 1e4213fc..e0bebdf7 100644 +--- src/CMakeLists.txt ++++ src/CMakeLists.txt +@@ -526,7 +526,7 @@ set(ENGINE_PACKAGES + gio-2.0 + glib-2.0 + gmime-2.6 +- javascriptcore-4.0 ++ javascriptcoregtk-4.0 + libxml-2.0 + posix + sqlite3 +@@ -551,7 +551,7 @@ set(WEB_PROCESS_PACKAGES + geary-engine + gee-0.8 + gtk+-3.0 +- javascriptcore-4.0 ++ javascriptcoregtk-4.0 + libsoup-2.4 + webkit2gtk-web-extension-4.0 + ) +@@ -618,7 +618,6 @@ add_definitions(${CFLAGS}) + set(VALAC_OPTIONS + --vapidir=${CMAKE_BINARY_DIR}/src + --vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi +- --metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata + --target-glib=${TARGET_GLIB} + --thread + --debug +@@ -650,38 +649,6 @@ set_property( + ) + target_link_libraries(geary-engine m ${DEPS_LIBRARIES} sqlite3-unicodesn) + +-# WebKit2GTK VAPI generation +-################################################# +-add_custom_target(webkit2gtk-vapi +- DEPENDS +- "${CMAKE_BINARY_DIR}/src/webkit2gtk-4.0.vapi" +- "${CMAKE_BINARY_DIR}/src/webkit2gtk-web-extension-4.0.vapi" +- "${CMAKE_SOURCE_DIR}/bindings/vapi/javascriptcore-4.0.vapi" +-) +-add_custom_command( +- OUTPUT +- ${CMAKE_BINARY_DIR}/src/webkit2gtk-4.0.vapi +- DEPENDS +- "${CMAKE_SOURCE_DIR}/bindings/metadata/WebKit2-4.0.metadata" +- "${CMAKE_SOURCE_DIR}/bindings/vapi/javascriptcore-4.0.vapi" +- WORKING_DIRECTORY +- "${CMAKE_SOURCE_DIR}/bindings/metadata" +- COMMAND +- vapigen --library=webkit2gtk-4.0 --pkg gtk+-3.0 --pkg libsoup-2.4 --pkg javascriptcore-4.0 --vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi --metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata --directory=${CMAKE_BINARY_DIR}/src `${PKG_CONFIG_EXECUTABLE} --variable=girdir gobject-introspection-1.0`/WebKit2-4.0.gir +-) +-add_custom_command( +- OUTPUT +- "${CMAKE_BINARY_DIR}/src/webkit2gtk-web-extension-4.0.vapi" +- DEPENDS +- "${CMAKE_SOURCE_DIR}/bindings/metadata/WebKit2WebExtension-4.0.metadata" +- "${CMAKE_SOURCE_DIR}/bindings/metadata/WebKit2WebExtension-4.0-custom.vala" +- "${CMAKE_SOURCE_DIR}/bindings/vapi/javascriptcore-4.0.vapi" +- WORKING_DIRECTORY +- "${CMAKE_SOURCE_DIR}/bindings/metadata" +- COMMAND +- vapigen --library=webkit2gtk-web-extension-4.0 --pkg gtk+-3.0 --pkg libsoup-2.4 --pkg javascriptcore-4.0 --vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi --metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata --directory=${CMAKE_BINARY_DIR}/src `${PKG_CONFIG_EXECUTABLE} --variable=girdir gobject-introspection-1.0`/WebKit2WebExtension-4.0.gir WebKit2WebExtension-4.0-custom.vala +-) +- + # Client library (static lib used for building client and unit tests) + ################################################# + +@@ -698,7 +665,7 @@ OPTIONS + ) + + add_library(geary-client STATIC ${CLIENT_VALA_C}) +-add_dependencies(geary-client resource_copy webkit2gtk-vapi) ++add_dependencies(geary-client resource_copy) + target_link_libraries(geary-client m ${DEPS_LIBRARIES} geary-engine) + + # Main client application binary +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index afcca95c..7517b3da 100644 +--- test/CMakeLists.txt ++++ test/CMakeLists.txt +@@ -56,7 +56,7 @@ set(TEST_PACKAGES + glib-2.0 + gmime-2.6 + gtk+-3.0 +- javascriptcore-4.0 ++ javascriptcoregtk-4.0 + libsoup-2.4 + webkit2gtk-4.0 + ) +-- +2.18.1 + Added: head/mail/geary/files/patch-e091f24 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/geary/files/patch-e091f24 Tue Nov 13 17:38:52 2018 (r484881) @@ -0,0 +1,72 @@ +https://gitlab.gnome.org/GNOME/geary/issues/37 + +From e091f24b00ec421e1aadd5e360d1550e658ad5ef Mon Sep 17 00:00:00 2001 +From: Michael James Gratton <mike@vee.net> +Date: Sun, 20 May 2018 19:07:56 +1000 +Subject: [PATCH] Clean up JS util API courtesy the new bindings. + +--- + src/client/util/util-webkit.vala | 2 +- + src/engine/util/util-js.vala | 12 +++++------- + 2 files changed, 6 insertions(+), 8 deletions(-) + +diff --git a/src/client/util/util-webkit.vala b/src/client/util/util-webkit.vala +index cba9eaf2..45a27c44 100644 +--- src/client/util/util-webkit.vala ++++ src/client/util/util-webkit.vala +@@ -64,7 +64,7 @@ namespace WebKitUtil { + JS.Value? err = null; + JS.String js_str = js_str_value.to_string_copy(context, out err); + Geary.JS.check_exception(context, err); +- return Geary.JS.to_string_released((owned) js_str); ++ return Geary.JS.to_native_string(js_str); + } + + /** +diff --git a/src/engine/util/util-js.vala b/src/engine/util/util-js.vala +index ea955e99..a98d7985 100644 +--- src/engine/util/util-js.vala ++++ src/engine/util/util-js.vala +@@ -82,7 +82,7 @@ namespace Geary.JS { + global::JS.String js_str = value.to_string_copy(context, out err); + Geary.JS.check_exception(context, err); + +- return Geary.JS.to_string_released((owned) js_str); ++ return to_native_string(js_str); + } + + /** +@@ -111,7 +111,7 @@ namespace Geary.JS { + /** + * Returns a JSC {@link JS.String} as a Vala {@link string}. + */ +- public inline string to_string_released(owned global::JS.String js) { ++ public inline string to_native_string(global::JS.String js) { + size_t len = js.get_maximum_utf8_cstring_size(); + uint8[] str = new uint8[len]; + #if VALA_0_42 +@@ -138,10 +138,8 @@ namespace Geary.JS { + global::JS.String js_name = new global::JS.String.create_with_utf8_cstring(name); + global::JS.Value? err = null; + global::JS.Value prop = object.get_property(context, js_name, out err); +- try { +- Geary.JS.check_exception(context, err); +- } finally { +- } ++ Geary.JS.check_exception(context, err); ++ + return prop; + } + +@@ -169,7 +167,7 @@ namespace Geary.JS { + + throw new Error.EXCEPTION( + "JS exception thrown [%s]: %s" +- .printf(err_type.to_string(), to_string_released((owned) err_str)) ++ .printf(err_type.to_string(), to_native_string(err_str)) + ); + } + } +-- +2.18.1 +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811131738.wADHcqqg097500>