diff --git a/modules/bluebillywigBidAdapter.js b/modules/bluebillywigBidAdapter.js index afacc48aa8e..cac993b0f8c 100644 --- a/modules/bluebillywigBidAdapter.js +++ b/modules/bluebillywigBidAdapter.js @@ -28,7 +28,7 @@ const BB_CONSTANTS = { const getConfig = config.getConfig; // Helper Functions -export const BB_HELPERS = { +const BB_HELPERS = { addSiteAppDevice: function(request, pageUrl) { if (typeof getConfig('app') === 'object') request.app = getConfig('app'); else { @@ -151,7 +151,7 @@ const BB_RENDERER = { const ele = document.getElementById(bid.adUnitCode); // NB convention const renderer = find(window.bluebillywig.renderers, r => r._id === rendererId); - if (renderer) renderer.bootstrap(config, ele); + if (renderer) renderer.bootstrap(config, ele, bid.rendererSettings || {}); else utils.logWarn(`${BB_CONSTANTS.BIDDER_CODE}: Couldn't find a renderer with ${rendererId}`); }, newRenderer: function(rendererUrl, adUnitCode) { @@ -235,6 +235,11 @@ export const spec = { return false; } + if (bid.params.hasOwnProperty('rendererSettings') && (bid.params.rendererSettings === null || typeof bid.params.rendererSettings !== 'object')) { + utils.logError(`${BB_CONSTANTS.BIDDER_CODE}: params.rendererSettings must be of type object. Rejecting bid: `, bid); + return false; + } + if (bid.hasOwnProperty('mediaTypes') && bid.mediaTypes.hasOwnProperty(VIDEO)) { if (!bid.mediaTypes[VIDEO].hasOwnProperty('context')) { utils.logError(`${BB_CONSTANTS.BIDDER_CODE}: no context specified in bid. Rejecting bid: `, bid); @@ -330,6 +335,7 @@ export const spec = { bid.publicationName = bidParams.publicationName; bid.rendererCode = bidParams.rendererCode; bid.accountId = bidParams.accountId; + bid.rendererSettings = bidParams.rendererSettings; const rendererUrl = BB_HELPERS.getRendererUrl(bid.publicationName, bid.rendererCode); bid.renderer = BB_RENDERER.newRenderer(rendererUrl, bid.adUnitCode); diff --git a/test/spec/modules/bluebillywigBidAdapter_spec.js b/test/spec/modules/bluebillywigBidAdapter_spec.js index 56ea29d6d73..3aee6c69438 100644 --- a/test/spec/modules/bluebillywigBidAdapter_spec.js +++ b/test/spec/modules/bluebillywigBidAdapter_spec.js @@ -210,6 +210,25 @@ describe('BlueBillywigAdapter', () => { bid.params.video = void (0); expect(spec.isBidRequestValid(bid)).to.equal(false); }); + + it('should fail if rendererSettings is specified but is not an object', () => { + const bid = deepClone(baseValidBid); + + bid.params.rendererSettings = null; + expect(spec.isBidRequestValid(bid)).to.equal(false); + + bid.params.rendererSettings = 'string'; + expect(spec.isBidRequestValid(bid)).to.equal(false); + + bid.params.rendererSettings = 123; + expect(spec.isBidRequestValid(bid)).to.equal(false); + + bid.params.rendererSettings = false; + expect(spec.isBidRequestValid(bid)).to.equal(false); + + bid.params.rendererSettings = void (0); + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); }); describe('buildRequests', () => {