diff --git a/modules/freewheelSSPBidAdapter.js b/modules/freewheelSSPBidAdapter.js index 7c696c746e67..64ebb36478bc 100644 --- a/modules/freewheelSSPBidAdapter.js +++ b/modules/freewheelSSPBidAdapter.js @@ -47,7 +47,9 @@ function getPricing(xmlNode) { var princingData = {}; var extensions = xmlNode.querySelectorAll('Extension'); - extensions.forEach(function(node) { + // Nodelist.forEach is not supported in IE and Edge + // Workaround given here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10638731/ + Array.prototype.forEach.call(extensions, function(node) { if (node.getAttribute('type') === 'StickyPricing') { pricingExtNode = node; } @@ -69,8 +71,9 @@ function getPricing(xmlNode) { function getCreativeId(xmlNode) { var creaId = ''; var adNodes = xmlNode.querySelectorAll('Ad'); - - adNodes.forEach(function(el) { + // Nodelist.forEach is not supported in IE and Edge + // Workaround given here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10638731/ + Array.prototype.forEach.call(adNodes, function(el) { creaId += '[' + el.getAttribute('id') + ']'; }); diff --git a/modules/rxrtbBidAdapter.js b/modules/rxrtbBidAdapter.js index cf03e41c208c..55b6991667af 100644 --- a/modules/rxrtbBidAdapter.js +++ b/modules/rxrtbBidAdapter.js @@ -12,7 +12,7 @@ export const spec = { code: BIDDER_CODE, supportedMediaTypes: [BANNER], isBidRequestValid: function (bidRequest) { - return 'params' in bidRequest && bidRequest.params.source !== undefined && bidRequest.params.id !== undefined && Number.isInteger(bidRequest.params.id) && bidRequest.params.token !== undefined; + return 'params' in bidRequest && bidRequest.params.source !== undefined && bidRequest.params.id !== undefined && utils.isInteger(bidRequest.params.id) && bidRequest.params.token !== undefined; }, buildRequests: function (validBidRequests) { var requests = []; @@ -100,7 +100,7 @@ function makeImp(req) { 'banner': makeBanner(req) }; - if (req.params.bidfloor && Number.isInteger(req.params.bidfloor)) { + if (req.params.bidfloor && utils.isInteger(req.params.bidfloor)) { imp.bidfloor = req.params.bidfloor } @@ -117,7 +117,7 @@ function makeBanner(req) { }); } banner.format = format; - if (req.params.pos && Number.isInteger(req.params.pos)) { + if (req.params.pos && utils.isInteger(req.params.pos)) { banner.pos = req.params.pos; } return banner; diff --git a/modules/serverbidServerBidAdapter.js b/modules/serverbidServerBidAdapter.js index 4ff8992772f6..4be96a09bd6d 100644 --- a/modules/serverbidServerBidAdapter.js +++ b/modules/serverbidServerBidAdapter.js @@ -139,12 +139,12 @@ ServerBidServerAdapter = function ServerBidServerAdapter() { } } if (data.placements.length) { - ajax(BASE_URI, _responseCallback(addBidResponse, bids), JSON.stringify(data), { method: 'POST', withCredentials: true, contentType: 'application/json' }); + ajax(BASE_URI, _responseCallback(addBidResponse, bids, done), JSON.stringify(data), { method: 'POST', withCredentials: true, contentType: 'application/json' }); } } } - function _responseCallback(addBidResponse, bids) { + function _responseCallback(addBidResponse, bids, done) { return function (resp) { let bid; let bidId; diff --git a/src/utils.js b/src/utils.js index 19014049352a..2d185ebe4c65 100644 --- a/src/utils.js +++ b/src/utils.js @@ -866,3 +866,16 @@ export function deletePropertyFromObject(object, prop) { export function removeRequestId(bid) { return exports.deletePropertyFromObject(bid, 'requestId'); } + +/** + * Checks input is integer or not + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger + * @param {*} value + */ +export function isInteger(value) { + if (Number.isInteger) { + return Number.isInteger(value); + } else { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + } +}