From 01d462db5ecb24df72eb349b069c502a4237826c Mon Sep 17 00:00:00 2001 From: troyfactor4 Date: Sun, 12 Apr 2020 16:56:06 -0300 Subject: [PATCH 1/2] Test suites of other projects (mocha) that include v1.5.0 fail with error: "Error: global leak detected: existingPrefixes" --- lib/signed-xml.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/signed-xml.js b/lib/signed-xml.js index 1b511d3d..54e09fd6 100644 --- a/lib/signed-xml.js +++ b/lib/signed-xml.js @@ -713,7 +713,7 @@ SignedXml.prototype.computeSignature = function(xml, opts, callback) { prefix = opts.prefix; attrs = opts.attrs || {}; location = opts.location || {}; - existingPrefixes = opts.existingPrefixes || {}; + var existingPrefixes = opts.existingPrefixes || {}; // defaults to the root node location.reference = location.reference || "/*"; // defaults to append action @@ -1017,4 +1017,4 @@ SignedXml.prototype.getOriginalXmlWithIds = function() { SignedXml.prototype.getSignedXml = function() { return this.signedXml -} \ No newline at end of file +} From 234bc0b99003fd0fbf06cb4f38174660c667a123 Mon Sep 17 00:00:00 2001 From: troyfactor4 Date: Sun, 12 Apr 2020 23:55:25 -0300 Subject: [PATCH 2/2] enable more use cases by returning the xml object in callback --- lib/signed-xml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/signed-xml.js b/lib/signed-xml.js index 54e09fd6..b02ff078 100644 --- a/lib/signed-xml.js +++ b/lib/signed-xml.js @@ -820,7 +820,7 @@ SignedXml.prototype.computeSignature = function(xml, opts, callback) { signatureDoc.insertBefore(self.createSignature(prefix), signedInfoNode.nextSibling) self.signatureXml = signatureDoc.toString() self.signedXml = doc.toString() - callback() + callback(null, self) } }) }