[rs-commit] r68 - /redwax-signtext/trunk/src/linux/chrome/page.js

rs-commit at redwax.eu rs-commit at redwax.eu
Sun Sep 18 19:25:14 CEST 2022


Author: minfrin at redwax.eu
Date: Sun Sep 18 19:25:13 2022
New Revision: 68

Log:
Fix various mismatches between variables in the firefox and chrome code.

Modified:
    redwax-signtext/trunk/src/linux/chrome/page.js

Modified: redwax-signtext/trunk/src/linux/chrome/page.js
==============================================================================
--- redwax-signtext/trunk/src/linux/chrome/page.js	(original)
+++ redwax-signtext/trunk/src/linux/chrome/page.js	Sun Sep 18 19:25:13 2022
@@ -63,17 +63,22 @@
 
                 const signTextHandler = function(e) {
                     /* message not for us */
-                    if (!(e.uuid === undefined) && !(e.uuid === uuid)) {
+                    if ((typeof e.detail.uuid === "undefined") || (e.detail.uuid !== uuid)) {
                         /* do nothing */
                     }
                     /* an error was received, cancel the stream */
-                    else if (e.error) {
-                        const error = new Error(e.error);
+                    else if (typeof e.detail.error !== "undefined") {
+                        const error = new Error(e.detail.error);
                         stringReject(error);
                         document.removeEventListener('eu.redwax.signTextResponse', signTextHandler);
                     }
+                    /* no response, weird, throw an error back */
+                    else if (typeof e.detail.response === "undefined") {
+                       stringReject(new Error("error:noResponse"));
+                       document.removeEventListener('eu.redwax.signTextResponse', signTextHandler);
+                    }
                     /* an ack was received, send the next chunk */
-                    else if (e.response === true) {
+                    else if (e.detail.response === true) {
                         document.dispatchEvent(new CustomEvent('eu.redwax.signTextRequest', {
                             bubbles: true,
                             detail: {
@@ -88,13 +93,13 @@
                         }));
                     }
                     /* an eos was received, we're done */
-                    else if (e.response === false) {
+                    else if (e.detail.response === false) {
                         stringResolve(result.join(""));
                         document.removeEventListener('eu.redwax.signTextResponse', signTextHandler);
                     }
                     /* a response was received, send ack */
                     else {
-                        result.push(e.response);
+                        result.push(e.default.response);
                         document.dispatchEvent(new CustomEvent('eu.redwax.signTextRequest', {
                             bubbles: true,
                             detail: {
@@ -132,8 +137,6 @@
                 return response;
             }
 
-alert("Hello there");
-
         }
 
     }, {



More information about the rs-commit mailing list