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

Improved anti-tracking integration #377

Merged
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Use new whitelisting API for anti-tracking module.

  • Loading branch information
sammacbeth committed May 6, 2019
commit e8dcae48e99ef2d0c1491ffe9fbcd2671a488176
@@ -1259,39 +1259,7 @@ function isWhitelisted(state) {
*/
antitracking.on('enabled', () => {
antitracking.isReady().then(() => {
// remove Cliqz-side whitelisting steps and replace with ghostery ones.
const replacedSteps = ['onBeforeSendHeaders', 'onHeadersReceived'].map(stage =>
Promise.all([
antitracking.action('addPipelineStep', stage, {
name: 'checkGhosteryWhitelisted',
spec: 'break',
fn: (state) => {
if (isWhitelisted(state)) {
const step = stage === 'onHeadersReceived' ? 'set_cookie' : 'cookie';
state.incrementStat(`${step}_allow_whitelisted`);
return false;
}
return true;
},
before: ['cookieContext.checkCookieTrust'],
})
])
).concat([
antitracking.action('removePipelineStep', 'onBeforeRequest', 'checkSourceWhitelisted'),
antitracking.action('addPipelineStep', 'onBeforeRequest', {
name: 'checkGhosteryWhitelisted',
spec: 'break',
fn: (state) => {
if (isWhitelisted(state)) {
state.incrementStat('ghostery_whitelisted');
return false;
}
return true;
},
before: ['checkShouldBlock'],
}),
]);
return Promise.all(replacedSteps);
antitracking.action('setWhiteListCheck', isWhitelisted);
});
});

ProTip! Use n and p to navigate between commits in a pull request.