[gjs: 1/3] Make DBus session and system props non-enumerable




commit d103072e42e4b4952877dbee75c3b5ab909ce732
Author: Sonny Piers <sonny fastmail net>
Date:   Sun May 29 14:13:13 2022 +0200

    Make DBus session and system props non-enumerable

 modules/core/overrides/Gio.js | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/modules/core/overrides/Gio.js b/modules/core/overrides/Gio.js
index 6cc29b17e..511d6c325 100644
--- a/modules/core/overrides/Gio.js
+++ b/modules/core/overrides/Gio.js
@@ -457,13 +457,6 @@ function _init() {
     Gio = this;
 
     Gio.DBus = {
-        get session() {
-            return Gio.bus_get_sync(Gio.BusType.SESSION, null);
-        },
-        get system() {
-            return Gio.bus_get_sync(Gio.BusType.SYSTEM, null);
-        },
-
         // Namespace some functions
         get: Gio.bus_get,
         get_finish: Gio.bus_get_finish,
@@ -478,6 +471,21 @@ function _init() {
         unwatch_name: Gio.bus_unwatch_name,
     };
 
+    Object.defineProperties(Gio.DBus, {
+        'session': {
+            get() {
+                return Gio.bus_get_sync(Gio.BusType.SESSION, null);
+            },
+            enumerable: false,
+        },
+        'system': {
+            get() {
+                return Gio.bus_get_sync(Gio.BusType.SYSTEM, null);
+            },
+            enumerable: false,
+        },
+    });
+
     Gio.DBusConnection.prototype.watch_name = function (name, flags, appeared, vanished) {
         return Gio.bus_watch_name_on_connection(this, name, flags, appeared, vanished);
     };


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