Port to webkit2gtk-4.0 to fix certificate verification; from upstream.

This commit is contained in:
ajacoutot 2016-01-08 10:28:42 +00:00
parent 2b8ef3c9bd
commit 7b9e394aea
7 changed files with 460 additions and 20 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.51 2015/08/25 12:57:33 sthen Exp $
# $OpenBSD: Makefile,v 1.52 2016/01/08 10:28:42 ajacoutot Exp $
COMMENT = digital photo organizer
GNOME_VERSION = 0.22.0
GNOME_PROJECT = shotwell
REVISION = 3
REVISION = 4
CATEGORIES = graphics
@ -13,16 +13,17 @@ HOMEPAGE = https://wiki.gnome.org/Apps/Shotwell
# LGPLv2
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes Xi
WANTLIB += Xinerama Xrandr Xrender atk-1.0 atk-bridge-2.0 atspi c cairo
WANTLIB += cairo-gobject dbus-1 epoxy exif exiv2 expat fontconfig
WANTLIB += freetype gdk-3 gdk_pixbuf-2.0 gee-0.8 gexiv2 gio-2.0 glib-2.0
WANTLIB += gmodule-2.0 gobject-2.0 gphoto2 gphoto2_port gstbase-1.0
WANTLIB += gstpbutils-1.0 gstreamer-1.0 gthread-2.0 gtk-3 harfbuzz
WANTLIB += javascriptcoregtk-3.0 json-glib-1.0 lcms2 m pango-1.0
WANTLIB += pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png pthread
WANTLIB += pthread-stubs raw rest-0.7 soup-2.4 sqlite3 stdc++
WANTLIB += webkitgtk-3.0 xcb xcb-render xcb-shm xml2 z graphite2
WANTLIB += X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes
WANTLIB += Xi Xinerama Xrandr Xrender atk-1.0 atk-bridge-2.0 atspi
WANTLIB += c cairo cairo-gobject dbus-1 epoxy exif exiv2 expat
WANTLIB += fontconfig freetype gdk-3 gdk_pixbuf-2.0 gee-0.8 gexiv2
WANTLIB += gio-2.0 glib-2.0 gmodule-2.0 gobject-2.0 gphoto2 gphoto2_port
WANTLIB += graphite2 gstbase-1.0 gstpbutils-1.0 gstreamer-1.0
WANTLIB += gthread-2.0 gtk-3 harfbuzz javascriptcoregtk-4.0 json-glib-1.0
WANTLIB += lcms2 m pango-1.0 pangocairo-1.0 pangoft2-1.0 pcre
WANTLIB += pixman-1 png pthread pthread-stubs raw rest-0.7 soup-2.4
WANTLIB += sqlite3 stdc++ webkit2gtk-4.0 xcb xcb-render xcb-shm
WANTLIB += xml2 z
MODULES = devel/dconf \
devel/gettext \
@ -36,13 +37,19 @@ LIB_DEPENDS = devel/json-glib \
graphics/libgphoto2 \
graphics/libraw \
net/librest \
www/webkit,gtk3
www/webkitgtk4
# beware: configure is an horrible homemade shell script
CONFIGURE_STYLE = simple
CONFIGURE_ARGS = --disable-desktop-update \
--disable-icon-update
# From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
# Subject: Port to webkit2gtk-4.0
post-extract:
rm ${WRKSRC}/vapi/webkitgtk-3.0.deps \
${WRKSRC}/vapi/webkitgtk-3.0.vapi
pre-configure:
${SUBST_CMD} ${WRKSRC}/plugins/Makefile.plugin.mk

View File

@ -1,10 +1,41 @@
$OpenBSD: patch-Makefile,v 1.17 2015/03/24 08:03:55 ajacoutot Exp $
$OpenBSD: patch-Makefile,v 1.18 2016/01/08 10:28:42 ajacoutot Exp $
From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709
remove gudev requirement
--- Makefile.orig Tue Mar 24 01:38:31 2015
+++ Makefile Tue Mar 24 08:45:05 2015
@@ -263,7 +263,6 @@ EXT_PKGS = \
--- Makefile.orig Fri Jan 8 11:10:39 2016
+++ Makefile Fri Jan 8 11:10:46 2016
@@ -14,7 +14,7 @@ VALAC := $(shell which $(VALAC))
endif
VALAC_VERSION := `$(VALAC) --version | awk '{print $$2}'`
-MIN_VALAC_VERSION := 0.20.1
+MIN_VALAC_VERSION := 0.28.0
INSTALL_PROGRAM := install
INSTALL_DATA := install -m 644
@@ -120,12 +120,10 @@ VAPI_FILES = \
LConv.vapi \
libexif.vapi \
libraw.vapi \
- webkitgtk-3.0.vapi \
unique-3.0.vapi \
unity.vapi
DEPS_FILES = \
- webkitgtk-3.0.deps \
unique-3.0.deps \
unity.deps
@@ -263,7 +261,6 @@ EXT_PKGS = \
gstreamer-base-1.0 \
gstreamer-pbutils-1.0 \
gtk+-3.0 \
@ -12,7 +43,16 @@ remove gudev requirement
libexif \
libgphoto2 \
json-glib-1.0 \
@@ -295,7 +294,6 @@ EXT_PKG_VERSIONS = \
@@ -271,7 +268,7 @@ EXT_PKGS = \
libsoup-2.4 \
libxml-2.0 \
sqlite3 \
- webkitgtk-3.0
+ webkit2gtk-4.0
ifdef UNITY_SUPPORT
EXT_PKGS += unity
endif
@@ -295,7 +292,6 @@ EXT_PKG_VERSIONS = \
gstreamer-plugins-base-1.0 >= 1.0.0 \
gstreamer-pbutils-1.0 >= 1.0.0 \
gtk+-3.0 >= 3.12.2 \
@ -20,7 +60,16 @@ remove gudev requirement
libexif >= 0.6.16 \
libgphoto2 >= 2.4.2 \
libraw >= 0.13.2 \
@@ -544,8 +542,8 @@ ifndef DISABLE_SCHEMAS_COMPILE
@@ -303,7 +299,7 @@ EXT_PKG_VERSIONS = \
libxml-2.0 >= 2.6.32 \
rest-0.7 >= 0.7 \
sqlite3 >= 3.5.9 \
- webkitgtk-3.0 >= 1.4.0 \
+ webkit2gtk-4.0 \
gnome-doc-utils
DIRECT_LIBS_VERSIONS =
@@ -544,8 +540,8 @@ ifndef DISABLE_SCHEMAS_COMPILE
glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas
endif
ifndef DISABLE_GSETTINGS_CONVERT_INSTALL
@ -31,7 +80,7 @@ remove gudev requirement
endif
ifndef DISABLE_ICON_UPDATE
-gtk-update-icon-cache -t -f $(DESTDIR)$(PREFIX)/share/icons/hicolor || :
@@ -721,9 +719,9 @@ pkgcheck:
@@ -721,9 +717,9 @@ pkgcheck:
.PHONY: valacheck
valacheck:
@ $(VALAC) --version >/dev/null 2>/dev/null || ( echo 'Shotwell requires Vala compiler $(MIN_VALAC_VERSION) or greater. No valac found in path or $$VALAC.'; exit 1 )

View File

@ -0,0 +1,103 @@
$OpenBSD: patch-plugins_common_RESTSupport_vala,v 1.1 2016/01/08 10:28:42 ajacoutot Exp $
From f045b7a13cc1efbfa3054338d0edf569df51f4e7 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 4 Dec 2015 17:34:17 +0100
Subject: Have all soup sessions validate TLS certificates
From a2844fbfeb23a0bf6b2489761ab5f51e15dc4efe Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 4 Dec 2015 17:33:43 +0100
Subject: Don't pack webview into a scrolled window
From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709
--- plugins/common/RESTSupport.vala.orig Fri Jan 8 11:11:42 2016
+++ plugins/common/RESTSupport.vala Fri Jan 8 11:12:07 2016
@@ -20,6 +20,7 @@ public abstract class Session {
public Session(string? endpoint_url = null) {
this.endpoint_url = endpoint_url;
soup_session = new Soup.SessionAsync();
+ this.soup_session.ssl_use_system_ca_file = true;
}
protected void notify_wire_message_unqueued(Soup.Message message) {
@@ -725,7 +726,6 @@ public abstract class GooglePublisher : Object, Spit.P
private WebKit.WebView webview;
private Gtk.Box pane_widget;
- private Gtk.ScrolledWindow webview_frame;
private string auth_sequence_start_url;
public signal void authorized(string auth_code);
@@ -735,26 +735,20 @@ public abstract class GooglePublisher : Object, Spit.P
pane_widget = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
- webview_frame = new Gtk.ScrolledWindow(null, null);
- webview_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN);
- webview_frame.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
webview = new WebKit.WebView();
webview.get_settings().enable_plugins = false;
- webview.get_settings().enable_default_context_menu = false;
- webview.load_finished.connect(on_page_load);
- webview.load_started.connect(on_load_started);
+ webview.load_changed.connect(on_page_load_changed);
+ webview.context_menu.connect(() => { return false; });
- webview_frame.add(webview);
- pane_widget.pack_start(webview_frame, true, true, 0);
+ pane_widget.pack_start(webview, true, true, 0);
}
public static bool is_cache_dirty() {
return cache_dirty;
}
- private void on_page_load(WebKit.WebFrame origin_frame) {
+ private void on_page_load() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
string page_title = webview.get_title();
@@ -772,9 +766,22 @@ public abstract class GooglePublisher : Object, Spit.P
}
}
- private void on_load_started(WebKit.WebFrame frame) {
+ private void on_load_started() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
}
+
+ private void on_page_load_changed (WebKit.LoadEvent load_event) {
+ switch (load_event) {
+ case WebKit.LoadEvent.STARTED:
+ on_load_started();
+ break;
+ case WebKit.LoadEvent.FINISHED:
+ on_page_load();
+ break;
+ }
+
+ return;
+ }
public Spit.Publishing.DialogPane.GeometryOptions get_preferred_geometry() {
return Spit.Publishing.DialogPane.GeometryOptions.NONE;
@@ -785,7 +792,7 @@ public abstract class GooglePublisher : Object, Spit.P
}
public void on_pane_installed() {
- webview.open(auth_sequence_start_url);
+ webview.load_uri(auth_sequence_start_url);
}
public void on_pane_uninstalled() {

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-plugins_shotwell-publishing-extras_Makefile,v 1.1 2016/01/08 10:28:42 ajacoutot Exp $
From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709
--- plugins/shotwell-publishing-extras/Makefile.orig Fri Jan 8 11:11:34 2016
+++ plugins/shotwell-publishing-extras/Makefile Fri Jan 8 11:10:48 2016
@@ -5,7 +5,7 @@ PLUGIN_PKGS := \
gtk+-3.0 \
libsoup-2.4 \
libxml-2.0 \
- webkitgtk-3.0 \
+ webkit2gtk-4.0 \
gee-0.8 \
rest-0.7 \
json-glib-1.0

View File

@ -0,0 +1,112 @@
$OpenBSD: patch-plugins_shotwell-publishing-extras_YandexPublishing_vala,v 1.1 2016/01/08 10:28:42 ajacoutot Exp $
From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709
--- plugins/shotwell-publishing-extras/YandexPublishing.vala.orig Fri Jan 8 11:11:38 2016
+++ plugins/shotwell-publishing-extras/YandexPublishing.vala Fri Jan 8 11:10:48 2016
@@ -120,43 +120,70 @@ internal class WebAuthPane : Spit.Publishing.DialogPan
webview = new WebKit.WebView();
webview.get_settings().enable_plugins = false;
- webview.get_settings().enable_default_context_menu = false;
- webview.load_finished.connect(on_page_load);
- webview.load_started.connect(on_load_started);
- webview.navigation_requested.connect(navigation_requested);
+ webview.load_changed.connect(on_page_load_changed);
+ webview.decide_policy.connect(on_decide_policy);
+ webview.context_menu.connect(() => { return false; });
webview_frame.add(webview);
pane_widget.pack_start(webview_frame, true, true, 0);
}
- private void on_page_load(WebKit.WebFrame origin_frame) {
+ private void on_page_load() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
}
- private WebKit.NavigationResponse navigation_requested (WebKit.WebFrame frame, WebKit.NetworkRequest req) {
- debug("Navigating to '%s'", req.uri);
+ private bool on_decide_policy (WebKit.PolicyDecision decision,
+ WebKit.PolicyDecisionType type) {
+ switch (type) {
+ case WebKit.PolicyDecisionType.NAVIGATION_ACTION:
+ WebKit.NavigationPolicyDecision n_decision = (WebKit.NavigationPolicyDecision) decision;
+ WebKit.NavigationAction action = n_decision.navigation_action;
+ string uri = action.get_request().uri;
+ debug("Navigating to '%s'", uri);
- MatchInfo info = null;
+ MatchInfo info = null;
- if (re.match(req.uri, 0, out info)) {
- string access_token = info.fetch_all()[2];
+ if (re.match(uri, 0, out info)) {
+ string access_token = info.fetch_all()[2];
- debug("Load completed: %s", access_token);
- pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
- if (access_token != null) {
- login_succeeded(access_token);
- return WebKit.NavigationResponse.IGNORE;
- } else
- login_failed();
+ debug("Load completed: %s", access_token);
+ pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
+ if (access_token != null) {
+ login_succeeded(access_token);
+ decision.ignore();
+ break;
+ } else
+ login_failed();
+ }
+ decision.use();
+ break;
+ case WebKit.PolicyDecisionType.RESPONSE:
+ decision.use();
+ break;
+ default:
+ return false;
}
- return WebKit.NavigationResponse.ACCEPT;
+ return true;
}
- private void on_load_started(WebKit.WebFrame frame) {
+ private void on_load_started() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
}
+ private void on_page_load_changed (WebKit.LoadEvent load_event) {
+ switch (load_event) {
+ case WebKit.LoadEvent.STARTED:
+ on_load_started();
+ break;
+ case WebKit.LoadEvent.FINISHED:
+ on_page_load();
+ break;
+ }
+
+ return;
+ }
+
public Gtk.Widget get_widget() {
return pane_widget;
}
@@ -166,7 +193,7 @@ internal class WebAuthPane : Spit.Publishing.DialogPan
}
public void on_pane_installed() {
- webview.open(login_url);
+ webview.load_uri(login_url);
}
public void on_pane_uninstalled() {

View File

@ -0,0 +1,125 @@
$OpenBSD: patch-plugins_shotwell-publishing_FacebookPublishing_vala,v 1.1 2016/01/08 10:28:42 ajacoutot Exp $
From b6aad5eb1af16acbb4ee4984e58dfeb08597923b Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 4 Dec 2015 18:08:54 +0100
Subject: facebook: Don't disable XSS auditor
From f045b7a13cc1efbfa3054338d0edf569df51f4e7 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 4 Dec 2015 17:34:17 +0100
Subject: Have all soup sessions validate TLS certificates
From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709
--- plugins/shotwell-publishing/FacebookPublishing.vala.orig Fri Jan 8 11:11:26 2016
+++ plugins/shotwell-publishing/FacebookPublishing.vala Fri Jan 8 11:12:21 2016
@@ -535,7 +535,7 @@ public class FacebookPublisher : Spit.Publishing.Publi
return;
debug("EVENT: endpoint test transaction failed to detect a connection to the Facebook " +
- "endpoint");
+ "endpoint" + error.message);
on_generic_error(error);
}
@@ -829,15 +829,14 @@ internal class WebAuthenticationPane : Spit.Publishing
webview = new WebKit.WebView();
webview.get_settings().enable_plugins = false;
- webview.get_settings().enable_default_context_menu = false;
- webview.load_finished.connect(on_page_load);
- webview.load_started.connect(on_load_started);
+ webview.load_changed.connect(on_page_load_changed);
+ webview.context_menu.connect(() => { return true; });
webview_frame.add(webview);
pane_widget.pack_start(webview_frame, true, true, 0);
}
-
+
private class LocaleLookup {
public string prefix;
public string translation;
@@ -945,10 +944,11 @@ internal class WebAuthenticationPane : Spit.Publishing
return "https://%s.facebook.com/dialog/oauth?client_id=%s&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=publish_actions,user_photos,user_videos&response_type=token".printf(facebook_locale, APPLICATION_ID);
}
- private void on_page_load(WebKit.WebFrame origin_frame) {
+ private void on_page_load() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
- string loaded_url = origin_frame.get_uri().dup();
+ string loaded_url = webview.uri.dup();
+ debug("loaded url: " + loaded_url);
// strip parameters from the loaded url
if (loaded_url.contains("?")) {
@@ -960,7 +960,7 @@ internal class WebAuthenticationPane : Spit.Publishing
// were we redirected to the facebook login success page?
if (loaded_url.contains("login_success")) {
cache_dirty = true;
- login_succeeded(origin_frame.get_uri());
+ login_succeeded(webview.uri);
return;
}
@@ -971,10 +971,24 @@ internal class WebAuthenticationPane : Spit.Publishing
}
}
- private void on_load_started(WebKit.WebFrame frame) {
+ private void on_load_started() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
}
+ private void on_page_load_changed (WebKit.LoadEvent load_event) {
+ switch (load_event) {
+ case WebKit.LoadEvent.STARTED:
+ case WebKit.LoadEvent.REDIRECTED:
+ on_load_started();
+ break;
+ case WebKit.LoadEvent.FINISHED:
+ on_page_load();
+ break;
+ }
+
+ return;
+ }
+
public static bool is_cache_dirty() {
return cache_dirty;
}
@@ -988,7 +1002,7 @@ internal class WebAuthenticationPane : Spit.Publishing
}
public void on_pane_installed() {
- webview.open(get_login_url());
+ webview.load_uri(get_login_url());
}
public void on_pane_uninstalled() {
@@ -1458,6 +1472,7 @@ internal class GraphSession {
this.soup_session.timeout = 15;
this.access_token = null;
this.current_message = null;
+ this.soup_session.ssl_use_system_ca_file = true;
}
~GraphSession() {
@@ -1527,6 +1542,7 @@ internal class GraphSession {
"Service %s returned HTTP status code %u %s", real_message.get_uri(),
msg.status_code, msg.reason_phrase);
} else {
+ debug(msg.reason_phrase);
error = new Spit.Publishing.PublishingError.NO_ANSWER(
"Failure communicating with %s (error code %u)", real_message.get_uri(),
msg.status_code);

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-plugins_shotwell-publishing_Makefile,v 1.1 2016/01/08 10:28:42 ajacoutot Exp $
From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709
--- plugins/shotwell-publishing/Makefile.orig Fri Jan 8 11:11:29 2016
+++ plugins/shotwell-publishing/Makefile Fri Jan 8 11:10:48 2016
@@ -5,7 +5,7 @@ PLUGIN_PKGS := \
gtk+-3.0 \
libsoup-2.4 \
libxml-2.0 \
- webkitgtk-3.0 \
+ webkit2gtk-4.0 \
gexiv2 \
rest-0.7 \
gee-0.8 \