From 97964ef56d39b618ab1152e2e7edfd283beb6247 Mon Sep 17 00:00:00 2001 From: Reinout Stevens Date: Wed, 28 Apr 2021 18:41:51 +0200 Subject: [PATCH] Consent Management Module: TCFApi in Iframe callId fix (#6634) * fix random id * lint * fix for real Co-authored-by: Reinout Stevens --- modules/consentManagement.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/consentManagement.js b/modules/consentManagement.js index 67af2baf959..6a13e73b8a2 100644 --- a/modules/consentManagement.js +++ b/modules/consentManagement.js @@ -199,13 +199,13 @@ 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) { window[apiName] = function (cmd, cmpVersion, callback, arg) { + let callId = Math.random() + ''; let msg = { [callName]: { command: cmd, @@ -226,6 +226,7 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) { window[apiName](commandName, cmpVersion, moduleCallback); } else { window[apiName] = function (cmd, arg, callback) { + let callId = Math.random() + ''; let msg = { [callName]: { command: cmd,