From 21a6c51a069632bb39bc0d7c4eb6ff1a71284425 Mon Sep 17 00:00:00 2001 From: Zaahir Moolla Date: Fri, 20 Oct 2023 15:49:10 -0400 Subject: [PATCH] Remove Chrome Counteract Exp code --- integration-test/atb.spec.js | 3 +-- shared/js/background/atb.js | 18 ------------------ unit-test/background/atb.js | 8 ++++---- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/integration-test/atb.spec.js b/integration-test/atb.spec.js index 39c4f761be..b4e29d9686 100644 --- a/integration-test/atb.spec.js +++ b/integration-test/atb.spec.js @@ -63,10 +63,9 @@ test.describe('install workflow', () => { const atb = await backgroundPage.evaluate(() => globalThis.dbg.settings.getSetting('atb')) const setAtb = await backgroundPage.evaluate(() => globalThis.dbg.settings.getSetting('set_atb')) const extiSent = await backgroundPage.evaluate(() => globalThis.dbg.settings.getSetting('extiSent')) - const atbPattern = new RegExp('^' + mockAtb.version + '(vk|vj)?$') // check the extension's internal state is correct - expect(atb).toMatch(atbPattern) + expect(atb).toEqual(mockAtb.version) expect(setAtb).toEqual(atb) expect(extiSent).toBeTruthy() diff --git a/shared/js/background/atb.js b/shared/js/background/atb.js index 0fb9cac3d1..12844b1e4a 100644 --- a/shared/js/background/atb.js +++ b/shared/js/background/atb.js @@ -3,10 +3,8 @@ * Please see https://duck.co/help/privacy/atb for more information. */ import browser from 'webextension-polyfill' -import { getUserLocale } from './i18n.js' const settings = require('./settings') -const utils = require('./utils') const parseUserAgentString = require('../shared-utils/parse-user-agent-string') const load = require('./load') const browserWrapper = require('./wrapper') @@ -159,14 +157,7 @@ const ATB = (() => { return new URLSearchParams() }, - getChromeCounteractExpATB: (atb) => { - const variant = 'v' - const atbVariant = Math.random() < 0.5 ? 'k' : 'j' - return `${atb}${variant}${atbVariant}` - }, - updateATBValues: () => { - const browserInfo = parseUserAgentString() // wait until settings is ready to try and get atb from the page return settings.ready() .then(ATB.setInitialVersions) @@ -180,15 +171,6 @@ const ATB = (() => { return !!atb }) - // in case there is no assigned atb variant, enroll into Chrome Counteract experiment - if (!atb && - settings.getSetting('atb') && - utils.getBrowserName() === 'chrome' && - getUserLocale() === 'en' && - browserInfo.os !== 'l') { - atb = ATB.getChromeCounteractExpATB(settings.getSetting('atb')) - } - if (atb) { settings.updateSetting('atb', atb) } diff --git a/unit-test/background/atb.js b/unit-test/background/atb.js index 4a15b1845a..2c4d54e0d9 100644 --- a/unit-test/background/atb.js +++ b/unit-test/background/atb.js @@ -254,8 +254,8 @@ describe('complex install workflow cases', () => { return atb.updateATBValues() .then(() => { validateExtiWasHit('v112-2') - expect(settings.getSetting('atb')).toMatch(/v112-2(v[jk])?/) - expect(settings.getSetting('set_atb')).toMatch(/v112-2(v[jk])?/) + expect(settings.getSetting('atb')).toEqual('v112-2') + expect(settings.getSetting('set_atb')).toEqual('v112-2') }) }) it('should handle the install process correctly if there\'s DDG pages open that pass an ATB param', () => { @@ -282,8 +282,8 @@ describe('complex install workflow cases', () => { return atb.updateATBValues() .then(() => { validateExtiWasHit('v112-2') - expect(settings.getSetting('atb')).toMatch(/v112-2(v[jk])?/) - expect(settings.getSetting('set_atb')).toMatch(/v112-2(v[jk])?/) + expect(settings.getSetting('atb')).toEqual('v112-2') + expect(settings.getSetting('set_atb')).toEqual('v112-2') }) }) })