From a237df51d73bf65ca254f990aeb0a7bed2c434cb Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Fri, 20 May 2022 08:39:44 -0700 Subject: [PATCH] convert bidders: brave --- modules/admanBidAdapter.js | 1 + modules/adprimeBidAdapter.js | 1 + modules/bluebillywigBidAdapter.js | 2 +- modules/boldwinBidAdapter.js | 3 ++- modules/braveBidAdapter.js | 20 +++---------------- .../modules/bluebillywigBidAdapter_spec.js | 2 +- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/modules/admanBidAdapter.js b/modules/admanBidAdapter.js index 6c04a1383c0..4d47c4699ab 100644 --- a/modules/admanBidAdapter.js +++ b/modules/admanBidAdapter.js @@ -65,6 +65,7 @@ export const spec = { buildRequests: (validBidRequests = [], bidderRequest) => { let winTop = window; let location; + // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin try { location = new URL(bidderRequest.refererInfo.page) winTop = window.top; diff --git a/modules/adprimeBidAdapter.js b/modules/adprimeBidAdapter.js index 77bcee92b12..4b53c8441ef 100644 --- a/modules/adprimeBidAdapter.js +++ b/modules/adprimeBidAdapter.js @@ -52,6 +52,7 @@ export const spec = { buildRequests: (validBidRequests = [], bidderRequest) => { let winTop = window; let location; + // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin try { location = new URL(bidderRequest.refererInfo.page) winTop = window.top; diff --git a/modules/bluebillywigBidAdapter.js b/modules/bluebillywigBidAdapter.js index d362dfa5fdb..27e310177f6 100644 --- a/modules/bluebillywigBidAdapter.js +++ b/modules/bluebillywigBidAdapter.js @@ -306,7 +306,7 @@ export const spec = { if (getConfig('coppa') == true) deepSetValue(request, 'regs.coppa', 1); // Enrich the request with any external data we may have - BB_HELPERS.addSiteAppDevice(request, bidderRequest.refererInfo && bidderRequest.refererInfo.referer); + BB_HELPERS.addSiteAppDevice(request, bidderRequest.refererInfo && bidderRequest.refererInfo.page); BB_HELPERS.addSchain(request, validBidRequests); BB_HELPERS.addCurrency(request); BB_HELPERS.addUserIds(request, validBidRequests); diff --git a/modules/boldwinBidAdapter.js b/modules/boldwinBidAdapter.js index fcff7134a92..33e99211e9b 100644 --- a/modules/boldwinBidAdapter.js +++ b/modules/boldwinBidAdapter.js @@ -51,8 +51,9 @@ export const spec = { buildRequests: (validBidRequests = [], bidderRequest) => { let winTop = window; let location; + // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin try { - location = new URL(bidderRequest.refererInfo.referer) + location = new URL(bidderRequest.refererInfo.page) winTop = window.top; } catch (e) { location = winTop.location; diff --git a/modules/braveBidAdapter.js b/modules/braveBidAdapter.js index 18bad6b0f75..d29d58a2129 100644 --- a/modules/braveBidAdapter.js +++ b/modules/braveBidAdapter.js @@ -62,23 +62,9 @@ export const spec = { return impObject; }); - let w = window; - let l = w.document.location.href; - let r = w.document.referrer; - - let loopChecker = 0; - while (w !== w.parent) { - if (++loopChecker == 10) break; - try { - w = w.parent; - l = w.location.href; - r = w.document.referrer; - } catch (e) { - break; - } - } - - let page = l || bidderRequest.refererInfo.referer; + // TODO: do these values make sense? + let page = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation; + let r = bidderRequest.refererInfo.ref; let data = { id: bidderRequest.bidderRequestId, diff --git a/test/spec/modules/bluebillywigBidAdapter_spec.js b/test/spec/modules/bluebillywigBidAdapter_spec.js index c831ddf6ddf..0a9c6b30c94 100644 --- a/test/spec/modules/bluebillywigBidAdapter_spec.js +++ b/test/spec/modules/bluebillywigBidAdapter_spec.js @@ -439,7 +439,7 @@ describe('BlueBillywigAdapter', () => { it('should add referrerInfo as site when no app is set', () => { const newValidBidderRequest = deepClone(validBidderRequest); - newValidBidderRequest.refererInfo = { referer: 'https://www.bluebillywig.com' }; + newValidBidderRequest.refererInfo = { page: 'https://www.bluebillywig.com' }; const request = spec.buildRequests(baseValidBidRequests, newValidBidderRequest); const payload = JSON.parse(request.data);