[gjs: 4/7] modified _promisify function




commit 23ab80c1cc2cdba6b1f2f457adc70b9cd2255e4f
Author: veena <veenanitks gmail com>
Date:   Tue Jun 1 00:41:02 2021 +0530

    modified _promisify function

 installed-tests/js/testGio.js | 5 ++---
 modules/core/overrides/Gio.js | 9 +++------
 2 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/installed-tests/js/testGio.js b/installed-tests/js/testGio.js
index ce0867e0..a2ad915b 100644
--- a/installed-tests/js/testGio.js
+++ b/installed-tests/js/testGio.js
@@ -65,13 +65,12 @@ describe('Sorting in ListStore', function () {
 
 describe('Promisify function', function () {
     it("doesn't crash when async function is not defined", function () {
-        expect(() => Gio._promisify(Gio.Subprocess.prototype, 'commuicate_utf8_async', 
'communicate_utf8_finish')).toThrowError(`commuicate_utf8_async is not defined`);
+        expect(() => Gio._promisify(Gio.Subprocess.prototype, 'commuicate_utf8_async', 
'communicate_utf8_finish')).toThrowError('commuicate_utf8_async is not defined');
     });
 
     it("doesn't crash when finish function is not defined", function () {
-        expect(() => Gio._promisify(Gio.Subprocess.prototype, 'communicate_utf8_async', 
'commuicate_utf8_finish')).toThrowError(`commuicate_utf8_finish is not defined`);
+        expect(() => Gio._promisify(Gio.Subprocess.prototype, 'communicate_utf8_async', 
'commuicate_utf8_finish')).toThrowError('commuicate_utf8_finish is not defined');
     });
-
 });
 
 describe('Gio.Settings overrides', function () {
diff --git a/modules/core/overrides/Gio.js b/modules/core/overrides/Gio.js
index 6cf0d836..811dc614 100644
--- a/modules/core/overrides/Gio.js
+++ b/modules/core/overrides/Gio.js
@@ -404,14 +404,11 @@ function* _listModelIterator() {
 }
 
 function _promisify(proto, asyncFunc, finishFunc) {
-    if (proto[asyncFunc] === undefined){
+    if (proto[asyncFunc] === undefined)
         throw new Error(`${asyncFunc} is not defined`);
-        return;
-    }
-    if (proto[finishFunc] === undefined){
+
+    if (proto[finishFunc] === undefined)
         throw new Error(`${finishFunc} is not defined`);
-        return;
-    }
 
     if (proto[`_original_${asyncFunc}`] !== undefined)
         return;


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