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....@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<Geary.Imap.Flag> {
     public string value { get; private set; }
-    
-    public Flag(string value) {
-        this.value = value;
+
+    /**
+     * Constructs a new flag.
+     *
+     * The given keyword must be an IMAP atom.
+     */
+    public Flag(string name) {
+        this.value = name;
     }
-    
+
     public bool is_system() {
         return value[0] == '\\';
     }
@@ -31,14 +36,14 @@
     public bool equal_to(Geary.Imap.Flag flag) {
         return (flag == this) ? true : flag.equals_string(value);
     }
-    
+
     /**
      * Returns the {@link Flag} as an appropriate {@link Parameter}.
      */
     public StringParameter to_parameter() throws ImapError {
-        return StringParameter.get_best_for(value);
+        return new UnquotedStringParameter(value);
     }
-    
+
     public uint hash() {
         return Ascii.stri_hash(value);
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geary-0.12.3/src/engine/imap/message/imap-mailbox-parameter.vala 
new/geary-0.12.4/src/engine/imap/message/imap-mailbox-parameter.vala
--- old/geary-0.12.3/src/engine/imap/message/imap-mailbox-parameter.vala        
2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap/message/imap-mailbox-parameter.vala        
1970-01-01 01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
-/* Copyright 2016 Software Freedom Conservancy Inc.
- *
- * This software is licensed under the GNU Lesser General Public License
- * (version 2.1 or later).  See the COPYING file in this distribution.
- */
-
-/**
- * A {@link StringParameter} that holds a mailbox reference (can be 
wildcarded).
- *
- * Used to juggle between our internal UTF-8 representation of mailboxes and 
IMAP's
- * odd "modified UTF-7" representation.  The value is stored in IMAP's encoded
- * format since that's how it comes across the wire.
- */
-
-public class Geary.Imap.MailboxParameter : StringParameter {
-    public MailboxParameter(string mailbox) {
-        base (utf8_to_imap_utf7(mailbox));
-    }
-    
-    public MailboxParameter.from_string_parameter(StringParameter 
string_parameter) {
-        base (string_parameter.ascii);
-    }
-    
-    private static string utf8_to_imap_utf7(string utf8) {
-        try {
-            return Geary.ImapUtf7.utf8_to_imap_utf7(utf8);
-        } catch (ConvertError e) {
-            debug("Error encoding mailbox name '%s': %s", utf8, e.message);
-            return utf8;
-        }
-    }
-    
-    private static string imap_utf7_to_utf8(string imap_utf7) {
-        try {
-            return Geary.ImapUtf7.imap_utf7_to_utf8(imap_utf7);
-        } catch (ConvertError e) {
-            debug("Invalid mailbox name '%s': %s", imap_utf7, e.message);
-            return imap_utf7;
-        }
-    }
-    
-    public string decode() {
-        return imap_utf7_to_utf8(ascii);
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public override void serialize(Serializer ser, Tag tag) throws Error {
-        serialize_string(ser);
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public override string to_string() {
-        return ascii;
-    }
-}
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geary-0.12.3/src/engine/imap/message/imap-mailbox-specifier.vala 
new/geary-0.12.4/src/engine/imap/message/imap-mailbox-specifier.vala
--- old/geary-0.12.3/src/engine/imap/message/imap-mailbox-specifier.vala        
2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap/message/imap-mailbox-specifier.vala        
2018-08-29 15:57:20.000000000 +0200
@@ -43,15 +43,37 @@
      * See [[http://tools.ietf.org/html/rfc3501#section-5.1]]
      */
     public bool is_inbox { get; private set; }
-    
+
+    /**
+     * Constructs a new specifier from a UTF-8 name.
+     */
     public MailboxSpecifier(string name) {
         init(name);
     }
-    
-    public MailboxSpecifier.from_parameter(MailboxParameter param) {
-        init(param.decode());
+
+    /**
+     * Constructs a new specifier from a IMAP modified-UTF-7 string.
+     *
+     * If a modified-UTF-7 decoding error occurs, the parameter will
+     * assumed to be UTF-8, repaired, and used instead.
+     */
+    public MailboxSpecifier.from_parameter(StringParameter param) {
+        string? name = null;
+        try {
+            name = Geary.ImapUtf7.imap_utf7_to_utf8(param.ascii);
+        } catch (ConvertError err) {
+            // Could no decode the name as IMAP modified UTF7, so per
+            // https://imapwiki.org/ClientImplementation/MailboxList
+            // assume UTF8.
+            debug(
+                "Error decoding mailbox name, assuming UTF-8: %s", err.message
+            );
+            name = param.ascii;
+        }
+
+        init(name);
     }
-    
+
     /**
      * Returns true if the {@link Geary.FolderPath} points to the IMAP Inbox.
      */
@@ -167,11 +189,18 @@
         
         return !String.is_empty(basename) ? basename : name;
     }
-    
+
     public Parameter to_parameter() {
-        return new MailboxParameter(name);
+        string encoded= Geary.ImapUtf7.utf8_to_imap_utf7(this.name);
+        Parameter? param = null;
+        try {
+            param = StringParameter.get_best_for(encoded);
+        } catch (ImapError err) {
+            param = new LiteralParameter(new 
Geary.Memory.StringBuffer(encoded));
+        }
+        return param;
     }
-    
+
     public uint hash() {
         return is_inbox ? Ascii.stri_hash(name) : Ascii.str_hash(name);
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geary-0.12.3/src/engine/imap/response/imap-mailbox-information.vala 
new/geary-0.12.4/src/engine/imap/response/imap-mailbox-information.vala
--- old/geary-0.12.3/src/engine/imap/response/imap-mailbox-information.vala     
2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap/response/imap-mailbox-information.vala     
2018-08-29 15:57:20.000000000 +0200
@@ -71,19 +71,21 @@
         // decode everything
         MailboxAttributes attributes = new MailboxAttributes(attrlist);
         StringParameter? delim = server_data.get_as_nullable_string(3);
-        MailboxParameter mailbox = new MailboxParameter.from_string_parameter(
-            server_data.get_as_string(4));
-        
-        // Set \Inbox to standard path
-        if (canonical_inbox && 
Geary.Imap.MailboxAttribute.SPECIAL_FOLDER_INBOX in attributes) {
-            return new MailboxInformation(MailboxSpecifier.inbox,
-                (delim != null) ? delim.nullable_ascii : null, attributes);
-        } else {
-            return new MailboxInformation(new 
MailboxSpecifier.from_parameter(mailbox),
-                (delim != null) ? delim.nullable_ascii : null, attributes);
-        }
+        StringParameter mailbox = server_data.get_as_string(4);
+
+        // If special-use flag \Inbox is set just use the canonical
+        // Inbox name, otherwise decode it
+        MailboxSpecifier? specifier =
+            (canonical_inbox &&
+             Geary.Imap.MailboxAttribute.SPECIAL_FOLDER_INBOX in attributes)
+            ? MailboxSpecifier.inbox
+            : new MailboxSpecifier.from_parameter(mailbox);
+
+        return new MailboxInformation(
+            specifier, (delim != null) ? delim.nullable_ascii : null, 
attributes
+        );
     }
-    
+
     /**
      * The {@link Geary.FolderPath} for the {@link mailbox}.
      *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geary-0.12.3/src/engine/imap/response/imap-status-data.vala 
new/geary-0.12.4/src/engine/imap/response/imap-status-data.vala
--- old/geary-0.12.3/src/engine/imap/response/imap-status-data.vala     
2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap/response/imap-status-data.vala     
2018-08-29 15:57:20.000000000 +0200
@@ -74,10 +74,9 @@
             throw new ImapError.PARSE_ERROR("Bad STATUS command name in 
response \"%s\"",
                 server_data.to_string());
         }
-        
-        MailboxParameter mailbox_param = new 
MailboxParameter.from_string_parameter(
-            server_data.get_as_string(2));
-        
+
+        StringParameter mailbox_param = server_data.get_as_string(2);
+
         int messages = UNSET;
         int recent = UNSET;
         UID? uid_next = null;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geary-0.12.3/src/engine/imap-db/imap-db-folder.vala 
new/geary-0.12.4/src/engine/imap-db/imap-db-folder.vala
--- old/geary-0.12.3/src/engine/imap-db/imap-db-folder.vala     2018-07-14 
04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/imap-db/imap-db-folder.vala     2018-08-29 
15:57:20.000000000 +0200
@@ -1919,25 +1919,27 @@
         MessageRow row = do_fetch_message_row(cx, location.message_id, 
Geary.Email.Field.FLAGS,
             out pre_fields, cancellable);
         post_fields = pre_fields;
-        
-        // compare flags for (a) any change at all and (b) unread changes
+
+        // Only update if changed
         Geary.Email row_email = row.to_email(location.email_id);
-        
-        if (row_email.email_flags != null && 
row_email.email_flags.equal_to(email.email_flags))
-            return;
-        
-        if (row_email.email_flags.is_unread() != email.email_flags.is_unread())
-            unread_count_change += email.email_flags.is_unread() ? 1 : -1;
-        
-        // write them out to the message row
-        Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags> map = new 
Gee.HashMap<ImapDB.EmailIdentifier,
-            Geary.EmailFlags>();
-        map.set((ImapDB.EmailIdentifier) email.id, email.email_flags);
-        
-        do_set_email_flags(cx, map, cancellable);
-        post_fields |= Geary.Email.Field.FLAGS;
+        if (row_email.email_flags == null ||
+            !row_email.email_flags.equal_to(email.email_flags)) {
+
+            // Check for unread count changes
+            if (row_email.email_flags != null &&
+                row_email.email_flags.is_unread() != 
email.email_flags.is_unread()) {
+                unread_count_change += email.email_flags.is_unread() ? 1 : -1;
+            }
+
+            Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags> map =
+               new Gee.HashMap<ImapDB.EmailIdentifier, Geary.EmailFlags>();
+            map.set((ImapDB.EmailIdentifier) email.id, email.email_flags);
+            do_set_email_flags(cx, map, cancellable);
+
+            post_fields |= Geary.Email.Field.FLAGS;
+        }
     }
-    
+
     private void do_merge_email(Db.Connection cx, LocationIdentifier location, 
Geary.Email email,
         out Geary.Email.Field pre_fields, out Geary.Email.Field post_fields,
         out Gee.Collection<Contact> updated_contacts, ref int 
unread_count_change,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geary-0.12.3/src/engine/util/util-imap-utf7.vala 
new/geary-0.12.4/src/engine/util/util-imap-utf7.vala
--- old/geary-0.12.3/src/engine/util/util-imap-utf7.vala        2018-07-14 
04:39:08.000000000 +0200
+++ new/geary-0.12.4/src/engine/util/util-imap-utf7.vala        2018-08-29 
15:57:20.000000000 +0200
@@ -94,7 +94,7 @@
     return -1;
 }
 
-public string utf8_to_imap_utf7(string str) throws ConvertError {
+public string utf8_to_imap_utf7(string str) {
     int p = first_encode_index(str);
     if (p < 0) {
         /* no characters that need to be encoded */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geary-0.12.3/test/CMakeLists.txt 
new/geary-0.12.4/test/CMakeLists.txt
--- old/geary-0.12.3/test/CMakeLists.txt        2018-07-14 04:39:08.000000000 
+0200
+++ new/geary-0.12.4/test/CMakeLists.txt        2018-08-29 15:57:20.000000000 
+0200
@@ -8,6 +8,8 @@
 
   engine/api/geary-attachment-test.vala
   engine/api/geary-engine-test.vala
+  engine/imap/message/imap-data-format-test.vala
+  engine/imap/message/imap-mailbox-specifier-test.vala
   engine/imap/transport/imap-deserializer-test.vala
   engine/mime-content-type-test.vala
   engine/rfc822-mailbox-address-test.vala
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geary-0.12.3/test/engine/imap/message/imap-data-format-test.vala 
new/geary-0.12.4/test/engine/imap/message/imap-data-format-test.vala
--- old/geary-0.12.3/test/engine/imap/message/imap-data-format-test.vala        
1970-01-01 01:00:00.000000000 +0100
+++ new/geary-0.12.4/test/engine/imap/message/imap-data-format-test.vala        
2018-08-29 15:57:20.000000000 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2018 Michael Gratton <m...@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.
+ */
+
+class Geary.Imap.DataFormatTest : Gee.TestCase {
+
+
+    public DataFormatTest() {
+        base("Geary.Imap.DataFormatTest");
+        add_test("is_atom_special", is_atom_special);
+    }
+
+    public void is_atom_special() {
+        assert_true(
+            !DataFormat.is_atom_special('a') && 
!DataFormat.is_atom_special('z')
+        );
+        assert_true(
+            !DataFormat.is_atom_special('A') && 
!DataFormat.is_atom_special('Z')
+        );
+        assert_true(
+            !DataFormat.is_atom_special('0') && 
!DataFormat.is_atom_special('9')
+        );
+        assert_true(
+            !DataFormat.is_atom_special('#') &&
+            !DataFormat.is_atom_special('.') &&
+            !DataFormat.is_atom_special('+') &&
+            !DataFormat.is_atom_special('/') &&
+            !DataFormat.is_atom_special('~') &&
+            !DataFormat.is_atom_special(':')
+        );
+
+        // atom-specials
+        assert_true(
+            DataFormat.is_atom_special('(')
+        );
+        assert_true(
+            DataFormat.is_atom_special(')')
+        );
+        assert_true(
+            DataFormat.is_atom_special('{')
+        );
+        assert_true(
+            DataFormat.is_atom_special(' ')
+        );
+        assert_true(
+            DataFormat.is_atom_special(0x00)
+        );
+        assert_true(
+            DataFormat.is_atom_special(0x1F)
+        );
+        assert_true(
+            DataFormat.is_atom_special(0x7F)
+        );
+        assert_true(
+            DataFormat.is_atom_special(0x80)
+        );
+        assert_true(
+            DataFormat.is_atom_special(0xFE)
+        );
+
+        // list-wildcards
+        assert_true(
+            DataFormat.is_atom_special('%')
+        );
+        assert_true(
+            DataFormat.is_atom_special('*')
+        );
+
+        // quoted-specials
+        assert_true(
+            DataFormat.is_atom_special('\"')
+        );
+        assert_true(
+            DataFormat.is_atom_special('\\')
+        );
+
+        // resp-specials
+        assert_true(
+            DataFormat.is_atom_special(']')
+        );
+    }
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geary-0.12.3/test/engine/imap/message/imap-mailbox-specifier-test.vala 
new/geary-0.12.4/test/engine/imap/message/imap-mailbox-specifier-test.vala
--- old/geary-0.12.3/test/engine/imap/message/imap-mailbox-specifier-test.vala  
1970-01-01 01:00:00.000000000 +0100
+++ new/geary-0.12.4/test/engine/imap/message/imap-mailbox-specifier-test.vala  
2018-08-29 15:57:20.000000000 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2018 Michael Gratton <m...@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.
+ */
+
+class Geary.Imap.MailboxSpecifierTest : Gee.TestCase {
+
+
+    public MailboxSpecifierTest() {
+        base("Geary.Imap.MailboxSpecifierTest");
+        add_test("to_parameter", to_parameter);
+        add_test("from_parameter", from_parameter);
+    }
+
+    public void to_parameter() {
+        assert(
+            "test" ==
+            new MailboxSpecifier("test").to_parameter().to_string()
+        );
+        assert(
+            "foo/bar" ==
+            new MailboxSpecifier("foo/bar").to_parameter().to_string()
+        );
+
+        // The param won't be quoted or escaped since
+        // QuotedStringParameter doesn't actually handle that, so just
+        // check that it is correct type
+        Parameter quoted = new MailboxSpecifier("""foo\bar""").to_parameter();
+        assert(quoted is QuotedStringParameter);
+
+        assert(
+            "ol&AOk-" ==
+            new MailboxSpecifier("olé").to_parameter().to_string()
+        );
+    }
+
+    public void from_parameter() {
+        assert(
+            "test" ==
+            new MailboxSpecifier.from_parameter(
+                new UnquotedStringParameter("test")).name
+        );
+
+        // This won't be quoted or escaped since QuotedStringParameter
+        // doesn't actually handle that.
+        assert(
+            "foo\\bar" ==
+            new MailboxSpecifier.from_parameter(
+                new QuotedStringParameter("""foo\bar""")).name
+        );
+        assert(
+            "olé" ==
+            new MailboxSpecifier.from_parameter(
+                new UnquotedStringParameter("ol&AOk-")).name
+        );
+    }
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geary-0.12.3/test/main.vala 
new/geary-0.12.4/test/main.vala
--- old/geary-0.12.3/test/main.vala     2018-07-14 04:39:08.000000000 +0200
+++ new/geary-0.12.4/test/main.vala     2018-08-29 15:57:20.000000000 +0200
@@ -40,7 +40,9 @@
     engine.add_suite(new Geary.AttachmentTest().get_suite());
     engine.add_suite(new Geary.EngineTest().get_suite());
     engine.add_suite(new Geary.HTML.UtilTest().get_suite());
+    engine.add_suite(new Geary.Imap.DataFormatTest().get_suite());
     engine.add_suite(new Geary.Imap.DeserializerTest().get_suite());
+    engine.add_suite(new Geary.Imap.MailboxSpecifierTest().get_suite());
     engine.add_suite(new Geary.IdleManagerTest().get_suite());
     engine.add_suite(new Geary.Inet.Test().get_suite());
     engine.add_suite(new Geary.JS.Test().get_suite());

++++++ geary-javascript-fixes.patch ++++++
>From 5d0f711426d76f878cf9b71f7e8f785199c7cde1 Mon Sep 17 00:00:00 2001
From: Rico Tzschichholz <ric...@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
--- 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 <m...@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
--- a/src/CMakeLists.txt
+++ b/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
--- a/test/CMakeLists.txt
+++ b/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.0


>From 0d966950a2cba888873cd3a7f4f42bb7a017dc6d Mon Sep 17 00:00:00 2001
From: Rico Tzschichholz <ric...@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
--- 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 <m...@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
--- 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


Reply via email to