Bug: https://bugzilla.gnome.org/show_bug.cgi?id=783882

--- geary-0.12~20170613.orig/src/client/web-process/web-process-extension.vala
+++ geary-0.12~20170613/src/client/web-process/web-process-extension.vala
@@ -86,7 +86,7 @@ public class GearyWebExtension : Object
     private bool should_load_remote_images(WebKit.WebPage page) {
         bool should_load = false;
         WebKit.Frame frame = page.get_main_frame();
-        JS.GlobalContext context = frame.get_javascript_global_context();
+        JS.GlobalContext context = (JS.GlobalContext) frame.get_javascript_global_context();
         try {
             JS.Value ret = execute_script(
                 context, "geary.allowRemoteImages", int.parse("__LINE__")
@@ -103,7 +103,7 @@ public class GearyWebExtension : Object
 
     private void remote_image_load_blocked(WebKit.WebPage page) {
         WebKit.Frame frame = page.get_main_frame();
-        JS.GlobalContext context = frame.get_javascript_global_context();
+        JS.GlobalContext context = (JS.GlobalContext) frame.get_javascript_global_context();
         try {
             execute_script(
                 context, "geary.remoteImageLoadBlocked();", int.parse("__LINE__")
@@ -118,7 +118,7 @@ public class GearyWebExtension : Object
 
     private void selection_changed(WebKit.WebPage page) {
         WebKit.Frame frame = page.get_main_frame();
-        JS.GlobalContext context = frame.get_javascript_global_context();
+        JS.GlobalContext context = (JS.GlobalContext) frame.get_javascript_global_context();
         try {
             execute_script(
                 context, "geary.selectionChanged();", int.parse("__LINE__")
