Skip to content

Commit

Permalink
convert bidders: brave
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 20, 2022
1 parent 94337ef commit a237df5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
1 change: 1 addition & 0 deletions modules/admanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions modules/adprimeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/bluebillywigBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion modules/boldwinBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 3 additions & 17 deletions modules/braveBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/bluebillywigBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a237df5

Please sign in to comment.