From 0806ff39336cda057ea9a17691b42a9d7bac4da0 Mon Sep 17 00:00:00 2001 From: Damyan Mitev <damyan.mitev@vereign.com> Date: Fri, 13 Dec 2019 17:10:55 +0200 Subject: [PATCH] add more debug and fixes --- javascript/src/iframe/viamapi-iframe.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/javascript/src/iframe/viamapi-iframe.js b/javascript/src/iframe/viamapi-iframe.js index d411b45..46818be 100644 --- a/javascript/src/iframe/viamapi-iframe.js +++ b/javascript/src/iframe/viamapi-iframe.js @@ -1424,7 +1424,7 @@ const connection = Penpal.connectToParent({ // body: String if it is a text part (Content-Type = "text/...") or Uint8Array otherwise; filled for leaf MIME nodes // parts: array of instances of the same object; filled for container MIME nodes (Content-Type = "multipart/...") // } - signVCard: async (passportUUID, senderEmail, attribs, text, html, parts = null) => { + signVCard: async (passportUUID, senderEmail, attribs, text, html, parts) => { const authenticationPublicKey = localStorage.getItem( "authenticatedIdentity" ); @@ -1437,6 +1437,15 @@ const connection = Penpal.connectToParent({ return encodeResponse("400", "", "Identity not authenticated"); } + try { + console.log("signVCard debug 1"); + console.log({parts}); + console.log("typeof parts", typeof parts); + console.log("typeof parts.unshift", typeof parts.unshift); + } catch(error) { + console.error(error); + } + const messageUUID = makeid(); const vCardAttribs = { @@ -1507,7 +1516,7 @@ const connection = Penpal.connectToParent({ debugger; try { - console.log("signVCard debug"); + console.log("signVCard debug 2"); console.log({parts}); console.log("typeof parts", typeof parts); console.log("typeof parts.unshift", typeof parts.unshift); @@ -1515,10 +1524,19 @@ const connection = Penpal.connectToParent({ console.error(error); } - if (!parts) { + if (typeof parts === "undefined" || parts === null) { parts = []; } + try { + console.log("signVCard debug 3"); + console.log({parts}); + console.log("typeof parts", typeof parts); + console.log("typeof parts.unshift", typeof parts.unshift); + } catch(error) { + console.error(error); + } + if (html) { const htmlPart = { headers: { -- GitLab