-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consent management module has race-condition with requestBids #2564
Comments
Your right about that. Sorry we need to update the example to add the queue stuff directly example page |
@mkendall07 do you mean queue the prebid stuff until the consent management library has loaded? If so that could be problematic in cases like prebid express (which is how we discovered this issue) as it initiates a |
No, the CMP has some queuing code that can be loaded sync to handle the race condition |
Okay. Not sure I quite understand, I was thinking of the consent module would have to handle the race-condition. But I might get it when I see the updated example :) |
@mkendall07 our QA is asking if there's any progress towards updating the example page. Unfortunately this issue still causes occasional test failures in our testing suite. |
@jsnellbaker |
@snapwich such approach would be difficult to implement, and not sure if required - IAB recommends implementing |
@YOzaz |
I'll update the sample test page to use the full setup example denoted on the 'setup' page instead of the 'quickstart' example. |
The updated code is now incorporated to the gdpr test page and merged into master. |
Type of issue
Bug
Description
The GDPR hello world example has the consent management library as loading
async
: https://github.com/prebid/Prebid.js/blob/master/integrationExamples/gpt/gdpr_hello_world.html#L4 which is probably the correct thing to do.However, the consent management module does not properly account for the library loading asynchronously. Here in the
lookupIabConsent
function (which is executed immediately on a call torequestBids
): https://github.com/prebid/Prebid.js/blob/master/modules/consentManagement.js#L49It checks for the
window.__cmp
function (an indicator that the library has loaded) and immediately assumes if it is not found that we're either in an iFrame or SafeFrame. But there's also the possibility that the library has not loaded yet.At this point the consent management module should wait until the library is loaded, or even more ideally, load further execution in a code block that the consent management library calls when it has loaded (similar to pbjs queue blocks) so that it can execute immediately when the CMP library has loaded.
Also, I think there needs to be better logic to detect whether we're in an iFrame or SafeFrame, because we don't want those methods to be waiting if they don't have to.
Steps to reproduce
Load the
<script src="//acdn.adnxs.com/cmp/cmp.complete.bundle.js" async></script>
tag using javascript in a setTimeout to defer loading for a few seconds in thegdpr_hello_world.html
example.Expected results
The auction is delayed while the consent management library loads.
Actual results
The consent module will fail inside
callCmpWhileInIframe
.The text was updated successfully, but these errors were encountered: