Skip to content

Commit

Permalink
Update consentManagementUsp.js to not store and reuse null consent (#…
Browse files Browse the repository at this point in the history
…5452)

* Update consentManagementUsp.js

* Update consentManagementUsp_spec.js

* Update amxBidAdapter.js

* Update amxBidAdapter.js

* Update consentManagementUsp_spec.js

* Update consentManagementUsp_spec.js

* Update consentManagementUsp_spec.js
  • Loading branch information
patmmccann authored Jul 21, 2020
1 parent bb91d54 commit 3a8f5cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 0 additions & 5 deletions modules/consentManagementUsp.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ export function requestBidsHook(fn, reqBidsConfigObj) {
timer: null
};

// in case we already have consent (eg during bid refresh)
if (consentData) {
return exitModule(null, hookConfig);
}

if (!uspCallMap[consentAPI]) {
utils.logWarn(`USP framework (${consentAPI}) is not a supported framework. Aborting consentManagement module and resuming auction.`);
return hookConfig.nextFn.apply(hookConfig.context, hookConfig.args);
Expand Down
7 changes: 5 additions & 2 deletions test/spec/modules/consentManagementUsp_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ describe('consentManagement', function () {
resetConsentData();
});

it('should bypass CMP and simply use previously stored consentData', function () {
// from prebid 4425 - "the USP (CCPA) api function __uspapi() always responds synchronously, whether or not privacy data is available, while the GDPR CMP may respond asynchronously
// Because the USP API does not wait for a user response, if it was not successfully obtained before the first auction, we should try again to retrieve privacy data before each subsequent auction.

it('should not bypass CMP and simply use previously stored consentData', function () {
let testConsentData = {
uspString: '1YY'
};
Expand All @@ -208,7 +211,7 @@ describe('consentManagement', function () {
let consent = uspDataHandler.getConsentData();
expect(didHookReturn).to.be.true;
expect(consent).to.equal(testConsentData.uspString);
sinon.assert.notCalled(uspStub);
sinon.assert.called(uspStub);
});
});

Expand Down

0 comments on commit 3a8f5cd

Please sign in to comment.