Disable captive portal helper if WebKitGTK is not installed

Resolves: RHEL-10488
This commit is contained in:
Michael Catanzaro 2023-10-18 14:53:04 -05:00
parent ef67107d97
commit 095feffe9e
2 changed files with 55 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: gnome-shell
Version: 3.32.2
Release: 53%{?dist}
Release: 54%{?dist}
Summary: Window management and application launching for GNOME
Group: User Interface/Desktops
@ -108,6 +108,9 @@ Patch20004: 0004-sessionMode-Allow-extensions-at-the-login-and-unlock.patch
# CVE-2020-17489
Patch30001: 0001-loginDialog-Reset-auth-prompt-on-vt-switch-before-fa.patch
# Disable captive portal helper if WebKitGTK is not installed (RHEL-10488)
Patch40001: optional-portal-helper.patch
%define libcroco_version 0.6.8
%define eds_version 3.17.2
%define gnome_desktop_version 3.7.90
@ -285,6 +288,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/evolution-calendar.de
%{_mandir}/man1/%{name}.1.gz
%changelog
* Wed Nov 01 2023 Michael Catanzaro <mcatanzaro@redhat.com> - 3.32.2-54
- Disable captive portal helper if WebKitGTK is not installed
Resolves: RHEL-10488
* Wed Oct 18 2023 Florian Müllner <fmuellner@redhat.com> - 3.32.2-53
- Fix window-menu closing immediately on open
Resolves: RHEL-2662

View File

@ -0,0 +1,47 @@
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;
}