Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/schain.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
isInteger,
_each,
logWarn,
deepAccess, deepSetValue
deepAccess, deepSetValue, deepClone
} from '../src/utils.js';
import {registerOrtbProcessor, REQUEST} from '../src/pbjsORTB.js';

Expand Down Expand Up @@ -180,7 +180,7 @@ export function makeBidRequestsHook(fn, bidderRequests) {
bidderRequest.bids.forEach(bid => {
let result = resolveSchainConfig(schainConfig, bidder);
if (result) {
bid.schain = result;
bid.schain = deepClone(result);
}
});
});
Expand Down
9 changes: 9 additions & 0 deletions test/spec/modules/schain_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ describe('#makeBidRequestsHook', function() {
makeBidRequestsHook(testCallback, testBidderRequests);
});

it('should not share the same schain object between different bid requests', (done) => {
config.setBidderConfig(goodStrictBidderConfig);
makeBidRequestsHook((requests) => {
requests[0].bids[0].schain.field = 'value';
expect(requests[1].bids[0].schain.field).to.not.exist;
done();
}, deepClone(bidderRequests))
});

it('should reject bad strict config but allow a bad relaxed config for bidders trying to override it', function () {
function testCallback(bidderRequests) {
expect(bidderRequests[0].bids[0].schain).to.exist;
Expand Down