Skip to content

Commit

Permalink
Consent Management Module: TCFApi in Iframe callId fix (#6634)
Browse files Browse the repository at this point in the history
* fix random id

* lint

* fix for real

Co-authored-by: Reinout Stevens <reinout@crazygames.com>
  • Loading branch information
2 people authored and idettman committed May 21, 2021
1 parent 44d1612 commit c21af77
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/consentManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit c21af77

Please sign in to comment.