Disable captive portal helper if WebKitGTK is not installed

Resolves: RHEL-10487
This commit is contained in:
Michael Catanzaro 2023-11-01 14:35:58 -05:00
parent 7ac3b2f9d7
commit 4bc20b36cb
2 changed files with 57 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Name: gnome-shell
Version: 40.10
Release: 15%{?dist}
Release: 16%{?dist}
Summary: Window management and application launching for GNOME
License: GPLv2+
@ -58,6 +58,7 @@ Patch54: 0001-st-icon-Only-get-resource-scale-after-peeking-theme-.patch
Patch55: 0001-window-tracker-Only-emit-tracked-windows-changed-on-.patch
Patch56: owe-support.patch
Patch57: 0001-windowMenu-Ignore-release.patch
Patch58: optional-portal-helper.patch
%define eds_version 3.33.1
%define gnome_desktop_version 3.35.91
@ -277,6 +278,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/evolution-calendar.de
%{_mandir}/man1/gnome-shell.1*
%changelog
* Wed Nov 01 2023 Michael Catanzaro <mcatanzaro@redhat.com> - 40.10-16
- Disable captive portal helper if WebKitGTK is not installed
Resolves: RHEL-10487
* Wed Oct 18 2023 Florian Müllner <fmuellner@redhat.com> - 40.10-15
- Fix window-menu closing immediately on open
Resolves: RHEL-2663

View File

@ -0,0 +1,51 @@
diff --git a/js/portalHelper/main.js b/js/portalHelper/main.js
index 25f866281..a221c3b88 100644
--- a/js/portalHelper/main.js
+++ b/js/portalHelper/main.js
@@ -4,10 +4,17 @@ imports.gi.versions.Soup = '2.4';
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;
const _ = Gettext.gettext;
+let WebKit;
+try {
+ WebKit = imports.gi.WebKit2;
+} catch {
+ WebKit = null;
+}
+
const Config = imports.misc.config;
const { loadInterfaceXML } = imports.misc.fileUtils;
@@ -346,6 +353,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 01c83c86b..8c5bd8dcb 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -2070,7 +2070,9 @@ class Indicator 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: %s'.format(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;
}