From 81bd83caec84383047e6cb66d177e2a8e5d0c93d Mon Sep 17 00:00:00 2001 From: Reinout Stevens Date: Wed, 21 Apr 2021 10:44:20 +0200 Subject: [PATCH 1/3] fix random id --- modules/consentManagement.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/consentManagement.js b/modules/consentManagement.js index 67af2baf959..db0215cb5dd 100644 --- a/modules/consentManagement.js +++ b/modules/consentManagement.js @@ -199,12 +199,12 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) { function callCmpWhileInIframe(commandName, cmpFrame, moduleCallback) { let apiName = (cmpVersion === 2) ? '__tcfapi' : '__cmp'; - let callId = Math.random() + ''; let callName = `${apiName}Call`; - + /* Setup up a __cmp function to do the postMessage and stash the callback. - This function behaves (from the caller's perspective identicially to the in-frame __cmp call */ + This function behaves (from the caller's perspective identicially to the in-frame __cmp call */ if (cmpVersion === 2) { + let callId = Math.random() + ''; window[apiName] = function (cmd, cmpVersion, callback, arg) { let msg = { [callName]: { @@ -225,6 +225,7 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) { // call CMP window[apiName](commandName, cmpVersion, moduleCallback); } else { + let callId = Math.random() + ''; window[apiName] = function (cmd, arg, callback) { let msg = { [callName]: { From 7ab2e2ea80178b14da4b4183e60ca10fc50bc775 Mon Sep 17 00:00:00 2001 From: Reinout Stevens Date: Wed, 21 Apr 2021 10:50:18 +0200 Subject: [PATCH 2/3] lint --- modules/consentManagement.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/consentManagement.js b/modules/consentManagement.js index db0215cb5dd..9c0c24d599c 100644 --- a/modules/consentManagement.js +++ b/modules/consentManagement.js @@ -200,7 +200,7 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) { let apiName = (cmpVersion === 2) ? '__tcfapi' : '__cmp'; let callName = `${apiName}Call`; - + /* Setup up a __cmp function to do the postMessage and stash the callback. This function behaves (from the caller's perspective identicially to the in-frame __cmp call */ if (cmpVersion === 2) { From 5b894c0d7133069192c2587ff40ff3b028879f9e Mon Sep 17 00:00:00 2001 From: Reinout Stevens Date: Wed, 21 Apr 2021 11:01:41 +0200 Subject: [PATCH 3/3] fix for real --- modules/consentManagement.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/consentManagement.js b/modules/consentManagement.js index 9c0c24d599c..6a13e73b8a2 100644 --- a/modules/consentManagement.js +++ b/modules/consentManagement.js @@ -204,8 +204,8 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) { /* Setup up a __cmp function to do the postMessage and stash the callback. This function behaves (from the caller's perspective identicially to the in-frame __cmp call */ if (cmpVersion === 2) { - let callId = Math.random() + ''; window[apiName] = function (cmd, cmpVersion, callback, arg) { + let callId = Math.random() + ''; let msg = { [callName]: { command: cmd, @@ -225,8 +225,8 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) { // call CMP window[apiName](commandName, cmpVersion, moduleCallback); } else { - let callId = Math.random() + ''; window[apiName] = function (cmd, arg, callback) { + let callId = Math.random() + ''; let msg = { [callName]: { command: cmd,