Skip to content

Commit 2cf1896

Browse files
Bill Newmanvladis-teqblazeAiholkinMykhailo Yaremchuk
authored
Colossus Bid Adapter: fix buildRequests (prebid#8236)
* add video&native traffic colossus ssp * Native obj validation * Native obj validation #2 * Added size field in requests * fixed test * fix merge conflicts * move to 3.0 * move to 3.0 * fix IE11 new URL issue * fix IE11 new URL issue * fix IE11 new URL issue * https for 3.0 * add https test * add ccp and schain features * fix test * sync with upstream, fix conflicts * Update colossussspBidAdapter.js remove commented code * Update colossussspBidAdapter.js lint fix * identity extensions * identity extensions * fix * fix * fix * fix * fix * add tests for user ids * fix * fix * fix * fix * fix * fix * fix * add gdpr support * add gdpr support * id5id support * Update colossussspBidAdapter.js add bidfloor parameter * Update colossussspBidAdapter.js check bidfloor * Update colossussspBidAdapter.js * Update colossussspBidAdapter.js * Update colossussspBidAdapter.js * Update colossussspBidAdapter_spec.js * use floor module * Revert "use floor module" This reverts commit f0c5c24. * use floor module * update to 5v * fix * add uid2 and bidFloor support * fix * add pbadslot support * fix conflicts * add onBidWon * refactor * add test for onBidWon() * fix * add group_id * Trigger circleci * fix * update user sync * fix window.location * fix test Co-authored-by: Vladislav Isaiko <[email protected]> Co-authored-by: Aiholkin <[email protected]> Co-authored-by: Mykhailo Yaremchuk <[email protected]>
1 parent dfac4ee commit 2cf1896

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

modules/colossussspBidAdapter.js

+25-4
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,33 @@ export const spec = {
6161
* @return ServerRequest Info describing the request to the server.
6262
*/
6363
buildRequests: (validBidRequests, bidderRequest) => {
64-
const winTop = getWindowTop();
65-
const location = winTop.location;
64+
let deviceWidth = 0;
65+
let deviceHeight = 0;
66+
let winLocation;
67+
68+
try {
69+
const winTop = getWindowTop();
70+
deviceWidth = winTop.screen.width;
71+
deviceHeight = winTop.screen.height;
72+
winLocation = winTop.location;
73+
} catch (e) {
74+
logMessage(e);
75+
winLocation = window.location;
76+
}
77+
78+
const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
79+
let refferLocation;
80+
try {
81+
refferLocation = refferUrl && new URL(refferUrl);
82+
} catch (e) {
83+
logMessage(e);
84+
}
85+
86+
const location = refferLocation || winLocation;
6687
let placements = [];
6788
let request = {
68-
deviceWidth: winTop.screen.width,
69-
deviceHeight: winTop.screen.height,
89+
deviceWidth,
90+
deviceHeight,
7091
language: (navigator && navigator.language) ? navigator.language : '',
7192
secure: location.protocol === 'https:' ? 1 : 0,
7293
host: location.host,

test/spec/modules/colossussspBidAdapter_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('ColossussspAdapter', function () {
109109
}
110110
});
111111
it('Returns empty data if no valid requests are passed', function () {
112-
serverRequest = spec.buildRequests([]);
112+
serverRequest = spec.buildRequests([], bidderRequest);
113113
let data = serverRequest.data;
114114
expect(data.placements).to.be.an('array').that.is.empty;
115115
});

0 commit comments

Comments
 (0)