gnome-shell/SOURCES/optional-portal-helper.patch

48 lines
1.8 KiB
Diff

diff --git a/js/portalHelper/main.js b/js/portalHelper/main.js
index e163d6574..c61f3b381 100644
--- a/js/portalHelper/main.js
+++ b/js/portalHelper/main.js
@@ -1,6 +1,13 @@
const Format = imports.format;
const Gettext = imports.gettext;
-const { Gio, GLib, GObject, Gtk, Pango, Soup, WebKit2: WebKit } = imports.gi;
+const { Gio, GLib, GObject, Gtk, Pango, Soup } = imports.gi;
+
+let WebKit;
+try {
+ WebKit = imports.gi.WebKit2;
+} catch {
+ WebKit = null;
+}
const _ = Gettext.gettext;
@@ -340,6 +346,11 @@ function initEnvironment() {
function main(argv) {
initEnvironment();
+ if (!WebKit) {
+ log('WebKit2 typelib is not installed, captive portal helper will be disabled');
+ return 1;
+ }
+
if (!WebKit.WebContext.new_ephemeral) {
log('WebKitGTK 2.16 is required for the portal-helper, see https://bugzilla.gnome.org/show_bug.cgi?id=780453');
return 1;
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 421d2e7d2..13b6501e7 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -2010,7 +2010,9 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper',
'/org/gnome/Shell/PortalHelper', (proxy, error) => {
if (error) {
- log('Error launching the portal helper: ' + error);
+ // Timeout is expected if WebKit is unavailable
+ if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.TIMED_OUT))
+ log('Error launching the portal helper: ' + error);
return;
}