diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js index a4b4f2d6728..ac5ba659ad7 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', @@ -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) { 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 () {