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

Adding return after rejects in a few places. Implementing Ghostery side of GH-885. Fix for GH-871. #10

Merged
merged 10 commits into from Mar 23, 2018

Requested changes.

  • Loading branch information
Serge Zarembsky
Serge Zarembsky committed Mar 23, 2018
commit 0745205448c440d3e2e37c1215eea03355663b75
@@ -1008,7 +1008,7 @@ messageCenter.on('enabled', () => {
* }
* }
*/
log('GOT OFFER!!!!!!!!!!!!!!!!!!!!!!');
log('GOT OFFER', msg);
// first check that the message is from core and is the one we expect
if (msg.origin === 'offers-core' &&
msg.type === 'push-offer' &&
@@ -378,17 +378,15 @@ class EventHandlers {
let tab_host;
let fromRedirect;
let block;
let ss_unblock;
if (bug_id) {
app_id = bugDb.db.bugs[bug_id].aid;
cat_id = bugDb.db.apps[app_id].cat;
incognito = tabInfo.getTabInfo(tab_id, 'incognito');
tab_host = tabInfo.getTabInfo(tab_id, 'host');
fromRedirect = globals.REDIRECT_MAP.has(request_id);
const retVal = this._checkBlocking(app_id, cat_id, tab_id, tab_host, page_url, request_id);
block = retVal.block;
/* eslint prefer-destructuring: 0 */
if (retVal.ss_unblock) {
const { block1, ss_unblock } = this._checkBlocking(app_id, cat_id, tab_id, tab_host, page_url, request_id);
block = block1;
if (ss_unblock) {
// The way to pass this flag to Cliqz handlers
details.ghosteryWhitelisted = true;
}
@@ -104,7 +104,7 @@ class Policy {
*/
shouldBlock(app_id, cat_id, tab_id, tab_host, tab_url) {
if (globals.SESSION.paused_blocking) {
return { block: false };
return { block: false, ss_unblock: false };
}

const ss_unblock = conf.toggle_individual_trackers && conf.site_specific_unblocks.hasOwnProperty(tab_host) && conf.site_specific_unblocks[tab_host].includes(+app_id);
@@ -116,26 +116,26 @@ class Policy {
if (conf.selected_app_ids.hasOwnProperty(app_id)) {
if (ss_unblock) {
if (this.blacklisted(tab_url)) {
return { block: !c2pDb.allowedOnce(tab_id, app_id) };
return { block: !c2pDb.allowedOnce(tab_id, app_id), ss_unblock: false };
}
return { block: false };
return { block: false, ss_unblock: false };
}
if (this.whitelisted(tab_url)) {
return { block: false };
return { block: false, ss_unblock: false };
}
return { block: !c2pDb.allowedOnce(tab_id, app_id) };
return { block: !c2pDb.allowedOnce(tab_id, app_id), ss_unblock: false };
}
// We get here when app_id is not selected for blocking
if (conf.toggle_individual_trackers && conf.site_specific_blocks.hasOwnProperty(tab_host) && conf.site_specific_blocks[tab_host].includes(+app_id)) {
if (this.whitelisted(tab_url)) {
return { block: false };
return { block: false, ss_unblock: false };
}
return { block: !c2pDb.allowedOnce(tab_id, app_id) };
return { block: !c2pDb.allowedOnce(tab_id, app_id), ss_unblock: false };
}
if (this.blacklisted(tab_url)) {
return { block: !c2pDb.allowedOnce(tab_id, app_id) };
return { block: !c2pDb.allowedOnce(tab_id, app_id), ss_unblock: false };
}
return { block: false };
return { block: false, ss_unblock: false };
}
}

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