Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Chrome Counteract Exp code #2284

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading