Skip to content

Commit

Permalink
Remove Chrome Counteract Exp code (#2284)
Browse files Browse the repository at this point in the history
  • Loading branch information
moollaza committed Oct 24, 2023
1 parent 09b27eb commit 556382f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
3 changes: 1 addition & 2 deletions integration-test/atb.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
18 changes: 0 additions & 18 deletions shared/js/background/atb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions unit-test/background/atb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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')
})
})
})
Expand Down

0 comments on commit 556382f

Please sign in to comment.