From 35cfa1e1a387b07694258ed9d6c48b0133b1490a Mon Sep 17 00:00:00 2001 From: chino117 Date: Wed, 1 Jul 2020 11:20:27 -0300 Subject: [PATCH 1/3] Eplanning fix: decode parameters --- modules/eplanningBidAdapter.js | 4 ++-- test/spec/modules/eplanningBidAdapter_spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js index a4b4f2d6728..c468748cb04 100644 --- a/modules/eplanningBidAdapter.js +++ b/modules/eplanningBidAdapter.js @@ -44,7 +44,7 @@ export const spec = { params = {}; } else { url = 'https://' + (urlConfig.sv || DEFAULT_SV) + '/hb/1/' + urlConfig.ci + '/' + dfpClientId + '/' + getDomain(pageUrl) + '/' + sec; - const referrerUrl = bidderRequest.refererInfo.referer.reachedTop ? encodeURIComponent(window.top.document.referrer) : encodeURIComponent(bidderRequest.refererInfo.referer); + const referrerUrl = bidderRequest.refererInfo.referer.reachedTop ? window.top.document.referrer : bidderRequest.refererInfo.referer; if (storage.hasLocalStorage()) { registerViewabilityAllBids(bidRequests); @@ -53,7 +53,7 @@ export const spec = { params = { rnd: rnd, e: spaces.str, - ur: encodeURIComponent(pageUrl || FILE), + ur: pageUrl || FILE, r: 'pbjs', pbv: '$prebid.version$', ncb: '1', diff --git a/test/spec/modules/eplanningBidAdapter_spec.js b/test/spec/modules/eplanningBidAdapter_spec.js index ff03bf033af..f267680b46b 100644 --- a/test/spec/modules/eplanningBidAdapter_spec.js +++ b/test/spec/modules/eplanningBidAdapter_spec.js @@ -343,13 +343,13 @@ describe('E-Planning Adapter', function () { it('should return ur parameter with current window url', function () { const ur = spec.buildRequests(bidRequests, bidderRequest).data.ur; - expect(ur).to.equal(encodeURIComponent(bidderRequest.refererInfo.referer)); + expect(ur).to.equal(bidderRequest.refererInfo.referer); }); it('should return fr parameter when there is a referrer', function () { const request = spec.buildRequests(bidRequests, bidderRequest); const dataRequest = request.data; - expect(dataRequest.fr).to.equal(encodeURIComponent(refererUrl)); + expect(dataRequest.fr).to.equal(refererUrl); }); it('should return crs parameter with document charset', function () { From af3227bf9892439458819baec926e4623a8539c5 Mon Sep 17 00:00:00 2001 From: chino117 Date: Fri, 3 Jul 2020 13:45:56 -0300 Subject: [PATCH 2/3] Eplanning: Top calls are assured --- modules/eplanningBidAdapter.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js index c468748cb04..b05bc075659 100644 --- a/modules/eplanningBidAdapter.js +++ b/modules/eplanningBidAdapter.js @@ -317,11 +317,13 @@ function getViewabilityTracker() { } function isNotHiddenByNonFriendlyIframe() { - return (window === window.top) || window.frameElement; + try{ return (window === window.top) || window.frameElement; } catch(e) {} } function defineContext(e) { - context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined); + try { + context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined); + } catch(err) {} return context; } @@ -357,7 +359,7 @@ function getViewabilityTracker() { } function itIsNotHiddenByTabFocus() { - return getContext().top.document.hasFocus(); + try{ return getContext().top.document.hasFocus(); } catch(e) {} } function isDefined(e) { From 3c2371efe79ec097f0400c105d03d0d9eb39b1dd Mon Sep 17 00:00:00 2001 From: chino117 Date: Fri, 3 Jul 2020 13:57:55 -0300 Subject: [PATCH 3/3] Eplanning: fix syntax --- modules/eplanningBidAdapter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js index b05bc075659..ac5ba659ad7 100644 --- a/modules/eplanningBidAdapter.js +++ b/modules/eplanningBidAdapter.js @@ -317,13 +317,13 @@ function getViewabilityTracker() { } function isNotHiddenByNonFriendlyIframe() { - try{ return (window === window.top) || window.frameElement; } catch(e) {} + try { return (window === window.top) || window.frameElement; } catch (e) {} } function defineContext(e) { try { context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined); - } catch(err) {} + } catch (err) {} return context; } @@ -359,7 +359,7 @@ function getViewabilityTracker() { } function itIsNotHiddenByTabFocus() { - try{ return getContext().top.document.hasFocus(); } catch(e) {} + try { return getContext().top.document.hasFocus(); } catch (e) {} } function isDefined(e) {