Hello community,
here is the log from the commit of package geary for openSUSE:Factory checked in at 2018-09-03 10:35:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/geary (Old)
and /work/SRC/openSUSE:Factory/.geary.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "geary"
Mon Sep 3 10:35:47 2018 rev:40 rq:632526 version:0.12.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/geary/geary.changes 2018-08-15 10:37:55.216239783 +0200
+++ /work/SRC/openSUSE:Factory/.geary.new/geary.changes 2018-09-03 10:35:47.984777424 +0200
@@ -1,0 +2,14 @@
+Wed Aug 29 14:44:18 UTC 2018 - bjorn.lie@gmail.com
+
+- Update to version 0.12.4:
+ + Fix handling folder names with IMAP reserved characters, such
+ as backslashes.
+ + Fix dialog windows not focused after being first shown.
+ + Actually include the fix for "Move to folder" selection bug.
+ + Fix build under vala >= 0.41.
+ + Fixes for miscellaneous crashers.
+- Drop geary-unselect-folder-popover-rows.patch: Fixed upstream.
+- Add geary-javascript-fixes.patch: Fix fails to build with
+ WebkitGTK >= 2.21
+
+-------------------------------------------------------------------
Old:
----
geary-0.12.3.tar.xz
geary-unselect-folder-popover-rows.patch
New:
----
geary-0.12.4.tar.xz
geary-javascript-fixes.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ geary.spec ++++++
--- /var/tmp/diff_new_pack.JHbr4P/_old 2018-09-03 10:35:48.380778447 +0200
+++ /var/tmp/diff_new_pack.JHbr4P/_new 2018-09-03 10:35:48.380778447 +0200
@@ -17,15 +17,15 @@
Name: geary
-Version: 0.12.3
+Version: 0.12.4
Release: 0
Summary: An email reader for the GNOME desktop
License: LGPL-2.1-or-later AND CC-BY-3.0 AND BSD-2-Clause
Group: Productivity/Networking/Email/Clients
URL: https://wiki.gnome.org/Apps/Geary
Source0: https://download.gnome.org/sources/geary/0.12/%{name}-%{version}.tar.xz
-# PATCH-FIX-UPSTREAM geary-unselect-folder-popover-rows.patch -- Unselect folder popover rows on text entered to avoid phantom selection
-Patch0: geary-unselect-folder-popover-rows.patch
+# PATCH-FIX-UPSTREAM geary-javascript-fixes.patch -- Fix fails to build with WebkitGTK >= 2.21
+Patch0: geary-javascript-fixes.patch
BuildRequires: cmake
BuildRequires: fdupes
++++++ geary-0.12.3.tar.xz -> geary-0.12.4.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/.gitlab-ci.yml new/geary-0.12.4/.gitlab-ci.yml
--- old/geary-0.12.3/.gitlab-ci.yml 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/.gitlab-ci.yml 2018-08-29 15:57:20.000000000 +0200
@@ -78,7 +78,7 @@
script:
- dpkg-buildpackage -b -us -uc
-flatpack-package:
+flatpak-package:
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.28
stage: build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/CMakeLists.txt new/geary-0.12.4/CMakeLists.txt
--- old/geary-0.12.3/CMakeLists.txt 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/CMakeLists.txt 2018-08-29 15:57:20.000000000 +0200
@@ -19,7 +19,7 @@
#
set(GETTEXT_PACKAGE "geary")
set(RELEASE_NAME "Lightweight email client for GNOME.")
-set(VERSION "0.12.3")
+set(VERSION "0.12.4")
set(VERSION_INFO "Release")
set(LANGUAGE_SUPPORT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/locale)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/NEWS new/geary-0.12.4/NEWS
--- old/geary-0.12.3/NEWS 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/NEWS 2018-08-29 15:57:20.000000000 +0200
@@ -1,3 +1,15 @@
+Version 0.12.4
+~~~~~~~~~~~~~~
+Released: 2018-08-29
+
+Bug fixes included in this release:
+ * Fix handling folder names with IMAP reserved characters, such as
+ backslashes. Issue #40
+ * Fix dialog windows not focused after being first shown. Issue #43
+ * Actually include the fix for "Move to folder" selection bug. Issue #24
+ * Fix build under vala >= 0.41. Issue #86
+ * Fixes for miscellaneous crashers
+
Version 0.12.3
~~~~~~~~~~~~~~
Released: 2018-07-14
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/desktop/org.gnome.Geary.appdata.xml.in new/geary-0.12.4/desktop/org.gnome.Geary.appdata.xml.in
--- old/geary-0.12.3/desktop/org.gnome.Geary.appdata.xml.in 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/desktop/org.gnome.Geary.appdata.xml.in 2018-08-29 15:57:20.000000000 +0200
@@ -77,6 +77,19 @@
<translation type="gettext">geary</translation>
<releases>
+ <release version="0.12.4" date="2018-08-29">
+ <description>
+ <p>Bug fixes included in this release:</p>
+ <ul>
+ <li>Fix handling folder names with IMAP reserved characters, such as backslashes. Issue #40</li>
+ <li>Fix dialog windows not focused after being first shown. Issue #43</li>
+ <li>Actually include the fix for "Move to folder" selection bug. Issue #24</li>
+ <li>Fix build under vala >= 0.41. Issue #86</li>
+ <li>Fixes for miscellaneous crashers</li>
+ </ul>
+ </description>
+ </release>
+
<release version="0.12.3" date="2018-07-14">
<description>
<p>Bug fixes included in this release:</p>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/org.gnome.Geary.json new/geary-0.12.4/org.gnome.Geary.json
--- old/geary-0.12.3/org.gnome.Geary.json 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/org.gnome.Geary.json 2018-08-29 15:57:20.000000000 +0200
@@ -1,6 +1,7 @@
/* flatpak-builder config for Geary. */
{
"app-id": "org.gnome.Geary",
+ "branch": "geary-0.12",
"runtime": "org.gnome.Platform",
"runtime-version": "3.28",
"sdk": "org.gnome.Sdk",
@@ -78,7 +79,7 @@
"sources": [
{
"type": "git",
- "url": "https://git.gnome.org/browse/libgee",
+ "url": "https://gitlab.gnome.org/GNOME/libgee.git",
"tag": "0.20.0"
}
]
@@ -88,7 +89,7 @@
"sources": [
{
"type": "git",
- "url": "https://git.gnome.org/browse/gmime",
+ "url": "https://github.com/jstedfast/gmime.git",
"branch": "gmime-2-6"
}
]
@@ -98,7 +99,7 @@
"sources": [
{
"type": "git",
- "url": "https://git.gnome.org/browse/geary",
+ "url": "https://gitlab.gnome.org/GNOME/geary.git",
"branch": "geary-0.12"
}
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/po/POTFILES.in new/geary-0.12.4/po/POTFILES.in
--- old/geary-0.12.3/po/POTFILES.in 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/po/POTFILES.in 2018-08-29 15:57:20.000000000 +0200
@@ -269,7 +269,6 @@
src/engine/imap/message/imap-flag.vala
src/engine/imap/message/imap-flags.vala
src/engine/imap/message/imap-internal-date.vala
-src/engine/imap/message/imap-mailbox-parameter.vala
src/engine/imap/message/imap-mailbox-specifier.vala
src/engine/imap/message/imap-message-data.vala
src/engine/imap/message/imap-message-flag.vala
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/CMakeLists.txt new/geary-0.12.4/src/CMakeLists.txt
--- old/geary-0.12.3/src/CMakeLists.txt 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/CMakeLists.txt 2018-08-29 15:57:20.000000000 +0200
@@ -124,7 +124,6 @@
engine/imap/message/imap-flags.vala
engine/imap/message/imap-internal-date.vala
engine/imap/message/imap-mailbox-specifier.vala
-engine/imap/message/imap-mailbox-parameter.vala
engine/imap/message/imap-message-data.vala
engine/imap/message/imap-message-flag.vala
engine/imap/message/imap-message-flags.vala
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/client/application/geary-application.vala new/geary-0.12.4/src/client/application/geary-application.vala
--- old/geary-0.12.3/src/client/application/geary-application.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/client/application/geary-application.vala 2018-08-29 15:57:20.000000000 +0200
@@ -234,8 +234,11 @@
// Use present_with_time and a synthesised time so the present
// actually works, as a work around for Bug 766284
// https://bugzilla.gnome.org/show_bug.cgi?id=766284.
+ // Subtract 10ms from the current time to avoid the main
+ // window stealing the focus when presented just before
+ // showing a dialog (issue #43).
this.controller.main_window.present_with_time(
- (uint32) (get_monotonic_time() / 1000)
+ (uint32) (get_monotonic_time() / 1000) - 10
);
return true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/client/application/main.vala new/geary-0.12.4/src/client/application/main.vala
--- old/geary-0.12.3/src/client/application/main.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/client/application/main.vala 2018-08-29 15:57:20.000000000 +0200
@@ -17,7 +17,7 @@
//
// Packages can disable this fix with the --disable-poodle-ssl3 configure option.
#if !DISABLE_POODLE
- Environment.set_variable("G_TLS_GNUTLS_PRIORITY", "NORMAL:%COMPAT:%LATEST_RECORD_VERSION:!VERS-SSL3.0", false);
+ Environment.set_variable("G_TLS_GNUTLS_PRIORITY", "NORMAL:%COMPAT:!VERS-SSL3.0", false);
#endif
// Disable WebKit2 accelerated compositing here while we can't
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/client/components/folder-popover.vala new/geary-0.12.4/src/client/components/folder-popover.vala
--- old/geary-0.12.3/src/client/components/folder-popover.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/client/components/folder-popover.vala 2018-08-29 15:57:20.000000000 +0200
@@ -107,6 +107,9 @@
[GtkCallback]
private void on_search_entry_search_changed() {
invalidate_filter();
+ if (this.search_entry.get_text() != "") {
+ this.list_box.unselect_all();
+ }
}
private void invalidate_filter() {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/client/composer/composer-widget.vala new/geary-0.12.4/src/client/composer/composer-widget.vala
--- old/geary-0.12.3/src/client/composer/composer-widget.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/client/composer/composer-widget.vala 2018-08-29 15:57:20.000000000 +0200
@@ -1150,9 +1150,10 @@
private void on_detach() {
if (this.state == ComposerState.DETACHED)
return;
- Gtk.Widget? focus = this.container.top_window.get_focus();
+
+ Gtk.Widget? focused_widget = this.container.top_window.get_focus();
this.container.remove_composer();
- ComposerWindow window = new ComposerWindow(this);
+ ComposerWindow new_window = new ComposerWindow(this);
// Workaround a GTK+ crasher, Bug 771812. When the composer is
// re-parented, its menu_button's popover keeps a reference to
@@ -1168,11 +1169,19 @@
this.state = ComposerWidget.ComposerState.DETACHED;
this.header.detached();
update_composer_view();
- if (focus != null && focus.parent.visible) {
- ComposerWindow focus_win = focus.get_toplevel() as ComposerWindow;
- if (focus_win != null && focus_win == window)
- focus.grab_focus();
- } else {
+
+ // If the previously focused widget is in the new composer
+ // window then focus that, else focus something useful.
+ bool refocus = true;
+ if (focused_widget != null) {
+ ComposerWindow? focused_window =
+ focused_widget.get_toplevel() as ComposerWindow;
+ if (new_window == focused_window) {
+ focused_widget.grab_focus();
+ refocus = false;
+ }
+ }
+ if (refocus) {
set_focus();
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/client/conversation-viewer/conversation-web-view.vala new/geary-0.12.4/src/client/conversation-viewer/conversation-web-view.vala
--- old/geary-0.12.3/src/client/conversation-viewer/conversation-web-view.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/client/conversation-viewer/conversation-web-view.vala 2018-08-29 15:57:20.000000000 +0200
@@ -15,7 +15,7 @@
// Key codes we don't forward on to the super class on key press
// since we want to override them elsewhere, especially
// ConversationListBox.
- private const int[] BLACKLISTED_KEY_CODES = {
+ private const uint[] BLACKLISTED_KEY_CODES = {
Gdk.Key.space,
Gdk.Key.KP_Space,
Gdk.Key.Up,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/client/dialogs/attachment-dialog.vala new/geary-0.12.4/src/client/dialogs/attachment-dialog.vala
--- old/geary-0.12.3/src/client/dialogs/attachment-dialog.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/client/dialogs/attachment-dialog.vala 2018-08-29 15:57:20.000000000 +0200
@@ -60,7 +60,12 @@
public int run() {
int response = this.chooser.run();
if (response == Gtk.ResponseType.ACCEPT) {
- this.config.attachments_dir = this.chooser.get_current_folder();
+ // Current folder can be null, e.g. if selecting an
+ // attachment from Recent Files
+ string? current_folder = this.chooser.get_current_folder();
+ if (!Geary.String.is_empty(current_folder)) {
+ this.config.attachments_dir = current_folder;
+ }
}
return response;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/engine/api/geary-account-information.vala new/geary-0.12.4/src/engine/api/geary-account-information.vala
--- old/geary-0.12.3/src/engine/api/geary-account-information.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/api/geary-account-information.vala 2018-08-29 15:57:20.000000000 +0200
@@ -138,7 +138,6 @@
// being saved.
get { return (allow_save_sent_mail() ? _save_sent_mail : true); }
set { _save_sent_mail = value; }
- default = true;
}
// Order for display purposes.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/engine/imap/message/imap-data-format.vala new/geary-0.12.4/src/engine/imap/message/imap-data-format.vala
--- old/geary-0.12.3/src/engine/imap/message/imap-data-format.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap/message/imap-data-format.vala 2018-08-29 15:57:20.000000000 +0200
@@ -7,7 +7,10 @@
namespace Geary.Imap.DataFormat {
private const char[] ATOM_SPECIALS = {
- '(', ')', '{', ' ', '%', '*', '"'
+ '(', ')', '{', ' ', // CTL chars are handled by is_special_char
+ '%', '*', // list-wildcards
+ '"', '\\', // quoted-specials
+ ']' // resp-specials
};
private const char[] TAG_SPECIALS = {
@@ -21,12 +24,15 @@
}
private bool is_special_char(char ch, char[] ar, string? exceptions) {
- if (ch > 0x7F || ch.iscntrl())
+ // Check for CTL chars
+ if (ch <= 0x1F || ch >= 0x7F) {
return true;
-
- if (ch in ar)
+ }
+
+ if (ch in ar) {
return (exceptions != null) ? Ascii.index_of(exceptions, ch) < 0 : true;
-
+ }
+
return false;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geary-0.12.3/src/engine/imap/message/imap-flag.vala new/geary-0.12.4/src/engine/imap/message/imap-flag.vala
--- old/geary-0.12.3/src/engine/imap/message/imap-flag.vala 2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap/message/imap-flag.vala 2018-08-29 15:57:20.000000000 +0200
@@ -15,11 +15,16 @@
public abstract class Geary.Imap.Flag : BaseObject, Gee.Hashable
From 5d0f711426d76f878cf9b71f7e8f785199c7cde1 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz
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
--- a/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
--- a/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
--- a/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
--- a/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
--- a/bindings/vapi/javascriptcore-4.0.vapi
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2017 Michael Gratton
From 0d966950a2cba888873cd3a7f4f42bb7a017dc6d Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz
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 --- a/src/client/conversation-viewer/conversation-web-view.vala +++ b/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 --- a/src/client/util/util-webkit.vala +++ b/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 --- a/src/client/web-process/web-process-extension.vala +++ b/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 --- a/src/engine/util/util-js.vala +++ b/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.0
From e091f24b00ec421e1aadd5e360d1550e658ad5ef Mon Sep 17 00:00:00 2001 From: Michael James Gratton
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 --- a/src/client/util/util-webkit.vala +++ b/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 --- a/src/engine/util/util-js.vala +++ b/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.0