[gnome-shell] authPrompt: Don't propagate serviceName to setMessage



commit 32248e822689b9e3357481672396bab3738e6970
Author: Alessandro Bono <alessandro bono369 gmail com>
Date:   Fri Aug 5 12:56:04 2022 +0200

    authPrompt: Don't propagate serviceName to setMessage
    
    There isn't always a serviceName when we set a message. Furthermore we
    are passing the serviceName only to decide if we want to wiggle or not.
    Pass the wiggle parameters instead. If they are missing, we don't want
    to wiggle.
    
    This fixes the following error:
    JS ERROR: Exception in callback for signal: login-format-changed: Error: Wrong type number; string 
expected
    setMessage@resource:///org/gnome/shell/gdm/authPrompt.js:542:13
    _showRealmLoginHint@resource:///org/gnome/shell/gdm/loginDialog.js:931:26
    _emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
    _updateLoginFormat@resource:///org/gnome/shell/gdm/realmd.js:85:18
    _reloadRealm@resource:///org/gnome/shell/gdm/realmd.js:57:14
    _onRealmLoaded@resource:///org/gnome/shell/gdm/realmd.js:64:14
    _makeProxyWrapper/</<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:245:34
    
    Fallout from 526f0711f1a7b7bd8e4913845b5a559f2c93be5c.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5547
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2404>

 js/gdm/authPrompt.js | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 4623c1e7c8..865d1d22b1 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -351,7 +351,20 @@ var AuthPrompt = GObject.registerClass({
     }
 
     _onShowMessage(_userVerifier, serviceName, message, type) {
-        this.setMessage(serviceName, message, type);
+        let wiggleParameters = {duration: 0};
+
+        if (type === GdmUtil.MessageType.ERROR &&
+            this._userVerifier.serviceIsFingerprint(serviceName)) {
+            // TODO: Use Await for wiggle to be over before unfreezing the user verifier queue
+            wiggleParameters = {
+                duration: 65,
+                wiggleCount: 3,
+            };
+            this._userVerifier.increaseCurrentMessageTimeout(
+                wiggleParameters.duration * (wiggleParameters.wiggleCount + 2));
+        }
+
+        this.setMessage(message, type, wiggleParameters);
         this.emit('prompted');
     }
 
@@ -525,7 +538,7 @@ var AuthPrompt = GObject.registerClass({
         });
     }
 
-    setMessage(serviceName, message, type) {
+    setMessage(message, type, wiggleParameters = {duration: 0}) {
         if (type == GdmUtil.MessageType.ERROR)
             this._message.add_style_class_name('login-dialog-message-warning');
         else
@@ -545,17 +558,7 @@ var AuthPrompt = GObject.registerClass({
             this._message.opacity = 0;
         }
 
-        if (type === GdmUtil.MessageType.ERROR &&
-            this._userVerifier.serviceIsFingerprint(serviceName)) {
-            // TODO: Use Await for wiggle to be over before unfreezing the user verifier queue
-            const wiggleParameters = {
-                duration: 65,
-                wiggleCount: 3,
-            };
-            this._userVerifier.increaseCurrentMessageTimeout(
-                wiggleParameters.duration * (wiggleParameters.wiggleCount + 2));
-            Util.wiggle(this._message, wiggleParameters);
-        }
+        Util.wiggle(this._message, wiggleParameters);
     }
 
     updateSensitivity(sensitive) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]