[polari] thumbnailer: Also fall back to WebKit2-4.0
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] thumbnailer: Also fall back to WebKit2-4.0
- Date: Sun, 8 Aug 2021 00:15:47 +0000 (UTC)
commit 52f163906eaf821ebef1e38b43e30a29aa53a33e
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Aug 3 15:12:24 2021 +0200
thumbnailer: Also fall back to WebKit2-4.0
Just like Soup3, we cannot assume that WebKit2-4.1 is available
everywhere already.
https://gitlab.gnome.org/GNOME/polari/-/merge_requests/207
src/thumbnailer.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/thumbnailer.js b/src/thumbnailer.js
index 01ed7885..7dada3a5 100644
--- a/src/thumbnailer.js
+++ b/src/thumbnailer.js
@@ -4,7 +4,15 @@ import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk?version=3.0';
-import WebKit2 from 'gi://WebKit2?version=4.1';
+
+import gi from 'gi';
+let WebKit2;
+
+try {
+ WebKit2 = gi.require('WebKit2', '4.1');
+} catch (e) {
+ WebKit2 = gi.require('WebKit2', '4.0');
+}
Gio._promisify(WebKit2.WebView.prototype, 'get_snapshot', 'get_snapshot_finish');
Gio._promisify(WebKit2.WebView.prototype, 'run_javascript', 'run_javascript_finish');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]