From bcfd4dfaa55fadff34f9cf036e0363668cc9d3c8 Mon Sep 17 00:00:00 2001 From: wlycdgr Date: Wed, 2 Sep 2020 12:23:17 -0400 Subject: [PATCH] Return early from setupHubPromoABTest if A/B tests have not yet been fetched to avoid misinterpreting absense of 'hub_plain' or 'hub_midnight' --- src/background.js | 7 ++++++- src/classes/ABTest.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index f17467dfd..4df749520 100644 --- a/src/background.js +++ b/src/background.js @@ -1118,7 +1118,12 @@ function getAntitrackingTestConfig() { * @return {Object} Hub promotion configuration parameters */ function setupHubPromoABTest() { - if (conf.hub_promo_variant !== 'not_yet_set') return; + if ( + !abtest.hasBeenFetched + || conf.hub_promo_variant !== 'not_yet_set' + ) { + return; + } if (abtest.hasTest('hub_plain')) { conf.hub_promo_variant = 'plain'; diff --git a/src/classes/ABTest.js b/src/classes/ABTest.js index df7a235fb..1236310ce 100644 --- a/src/classes/ABTest.js +++ b/src/classes/ABTest.js @@ -27,6 +27,7 @@ const { BROWSER_INFO, CMP_BASE_URL, EXTENSION_VERSION } = globals; class ABTest { constructor() { this.tests = {}; + this.hasBeenFetched = false; } /** @@ -63,6 +64,7 @@ class ABTest { (tests, test) => Object.assign(tests, { [test.name]: test.data }), {} ); + this.hasBeenFetched = true; } else { log('A/B Tests: no tests found.'); }