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 all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -46,7 +46,7 @@
},
"dependencies": {
"base64-js": "^1.2.1",
"browser-core": "https://s3.amazonaws.com/cdncliqz/update/edge/ghostery/v7.36/7.36.2.712dbc7.tgz",
"browser-core": "https://s3.amazonaws.com/cdncliqz/update/edge/ghostery/v7.36/7.36.3.9f2e27e.tgz",
"classnames": "^2.2.5",
"d3": "^5.7.0",
"foundation-sites": "^6.4.4-rc1",
@@ -1220,7 +1220,6 @@ function initialiseWebRequestPipeline() {
const result = events.onBeforeRequest(state);
if (result && (result.cancel === true || result.redirectUrl)) {
Object.assign(response, result);
return false;
}
return true;
}
@@ -1259,39 +1258,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);
});
});

@@ -1251,9 +1251,9 @@ brorand@^1.0.1:
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=

"browser-core@https://s3.amazonaws.com/cdncliqz/update/edge/ghostery/v7.36/7.36.2.712dbc7.tgz":
version "7.36.2"
resolved "https://s3.amazonaws.com/cdncliqz/update/edge/ghostery/v7.36/7.36.2.712dbc7.tgz#8caba3e6b972808f4a650c1a0bd2ea9d42aba817"
"browser-core@https://s3.amazonaws.com/cdncliqz/update/edge/ghostery/v7.36/7.36.3.9f2e27e.tgz":
version "7.36.3"
resolved "https://s3.amazonaws.com/cdncliqz/update/edge/ghostery/v7.36/7.36.3.9f2e27e.tgz#57e439cb4e9364bc452d6ad0f811721d2973431f"
dependencies:
"@cliqz-oss/dexie" "^2.0.4"
"@cliqz/adblocker" "^0.8.0"
ProTip! Use n and p to navigate between commits in a pull request.