From 5162fb048749f3516d54e4bdba9c9d18863e4780 Mon Sep 17 00:00:00 2001 From: Juan Bono Date: Wed, 22 Jan 2020 13:38:56 -0300 Subject: [PATCH] [SENG-2757] remove custom function from adapter (#11) * remove loadExternalScript function * add adroll to the adloader whitelist --- modules/adrollBidAdapter.js | 27 +-------------------------- src/adloader.js | 3 ++- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/modules/adrollBidAdapter.js b/modules/adrollBidAdapter.js index 596de326707..d3b4496d984 100644 --- a/modules/adrollBidAdapter.js +++ b/modules/adrollBidAdapter.js @@ -1,6 +1,7 @@ import * as utils from '../src/utils'; import { registerBidder } from '../src/adapters/bidderFactory'; import { BANNER } from '../src/mediaTypes'; +import { loadExternalScript } from '../src/adloader'; import JSEncrypt from 'jsencrypt/bin/jsencrypt'; import sha256 from 'crypto-js/sha256'; @@ -285,30 +286,4 @@ function isFastBidTooOld(fastBidAge) { return false } -/** - * This is here to bypass the whitelist. - * Once we're ready to merge the adapter to mainstream prebid, we should switch - * from this function to adloader.loadExternalScript - */ -const _requestCache = {}; -function loadExternalScript(url, moduleCode) { - if (!moduleCode || !url) { - utils.logError('cannot load external script without url and moduleCode'); - return; - } - - // only load each asset once - if (_requestCache[url]) { - return; - } - - const script = document.createElement('script'); - script.type = 'text/javascript'; - script.async = true; - script.src = url; - - utils.insertElement(script); - _requestCache[url] = true; -}; - registerBidder(spec); diff --git a/src/adloader.js b/src/adloader.js index 22bfe0ef4f2..0f82d333c2b 100644 --- a/src/adloader.js +++ b/src/adloader.js @@ -7,7 +7,8 @@ const _approvedLoadExternalJSList = [ 'criteo', 'outstream', 'adagio', - 'browsi' + 'browsi', + 'adroll' ] /**