From e275ef1d61617df6f70b7e88a173e9eba8c39934 Mon Sep 17 00:00:00 2001 From: Dave Bemiller Date: Thu, 15 Jun 2017 09:05:28 -0400 Subject: [PATCH 1/2] Added a try/catch block around the troublesome code. --- src/adapters/adyoulike.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/adapters/adyoulike.js b/src/adapters/adyoulike.js index 3968de6ce8f..4489d0723b7 100644 --- a/src/adapters/adyoulike.js +++ b/src/adapters/adyoulike.js @@ -66,9 +66,16 @@ var AdyoulikeAdapter = function AdyoulikeAdapter() { Placements: placements, }; - if (performance && performance.navigation) { - body.PageRefreshed = performance.navigation.type === performance.navigation.TYPE_RELOAD; - } + // performance isn't supported by mobile safari iOS7. window.performance works, but + // evaluates to true during unit tests, which is a failure. + // + // try/catch was added to un-block the Prebid 0.25 release, but the adyoulike adapter + // maintainers should revisit this and see if it's really what they want. + try { + if (performance && performance.navigation) { + body.PageRefreshed = performance.navigation.type === performance.navigation.TYPE_RELOAD; + } + } catch (e) { } return JSON.stringify(body); } From 633c133509a35f3b74e76abd64ee6bc11628aed2 Mon Sep 17 00:00:00 2001 From: Dave Bemiller Date: Thu, 15 Jun 2017 09:49:32 -0400 Subject: [PATCH 2/2] Defaulted to false, to make the unit tests pass. --- src/adapters/adyoulike.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/adapters/adyoulike.js b/src/adapters/adyoulike.js index 4489d0723b7..7ee65eebe06 100644 --- a/src/adapters/adyoulike.js +++ b/src/adapters/adyoulike.js @@ -67,7 +67,7 @@ var AdyoulikeAdapter = function AdyoulikeAdapter() { }; // performance isn't supported by mobile safari iOS7. window.performance works, but - // evaluates to true during unit tests, which is a failure. + // evaluates to true on a unit test which expects false. // // try/catch was added to un-block the Prebid 0.25 release, but the adyoulike adapter // maintainers should revisit this and see if it's really what they want. @@ -75,7 +75,9 @@ var AdyoulikeAdapter = function AdyoulikeAdapter() { if (performance && performance.navigation) { body.PageRefreshed = performance.navigation.type === performance.navigation.TYPE_RELOAD; } - } catch (e) { } + } catch (e) { + body.PageRefreshed = false; + } return JSON.stringify(body); }