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

GH-2097 bugfix: make sure alternate view displays when expected #618

Closed
wants to merge 35 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7a1ca55
bump browser core
christophertino Jul 31, 2020
4b3e192
Updated Firefox Android extension (#587)
christophertino Aug 10, 2020
a95835f
Added a product_id parameter (#574)
hankyje Aug 10, 2020
e3f9ff8
Display error message when locked out (#577)
afranco07 Aug 10, 2020
c161eca
udpated changelog
christophertino Aug 10, 2020
04c121a
update package dependencies
christophertino Aug 11, 2020
7e0a3c2
GH-2086, GH-2084, GH-2040: Update intro hub Get Plus, Midnight & Insi…
benstrumeyer Aug 14, 2020
124d633
GH-2035: Update In-App Plus/Premium pricing (#596)
benstrumeyer Aug 17, 2020
c1f3beb
Remove obsolete @cliqz/adblocker-circumvention dependency (#598)
remusao Aug 17, 2020
efccf8c
Fix bug where content overflows past the specified panel height in ru…
benstrumeyer Aug 25, 2020
fde426c
Shorten uninstall url by shorterning subscription_interval param name…
wlycdgr Aug 25, 2020
1719bc7
bump browser core
christophertino Sep 8, 2020
8c3c62b
update CODEOWNERS
christophertino Sep 11, 2020
0769c49
bump browser core
christophertino Sep 13, 2020
387f037
Return early from setupHubPromoABTest if A/B tests have not yet been …
wlycdgr Sep 21, 2020
bdf6206
Detect Ghostery Desktop browser (#602)
sammacbeth Sep 21, 2020
30a0d04
GH-2171: Add Missing Page Title to Upgrade Plan Hub Page (#604)
fcjr Sep 21, 2020
34c6223
GH-2168: Change hub logo link (#605)
leuryr Sep 21, 2020
27e21c1
update readme
christophertino Sep 21, 2020
4e0560b
prune dead links from readme
christophertino Sep 21, 2020
f1c8941
GH-2100, GH-2097: Onboarding test 2 (#603)
leuryr Sep 22, 2020
0781353
Feature/console debugging (#568)
IAmThePan Sep 24, 2020
e4b0a0b
ignore purplebox creation and updates on Android
christophertino Sep 24, 2020
443ca8a
fixing bug in debugger openPanel
christophertino Sep 24, 2020
7f975d1
GH-2159: Update frequency reduction, AB test opt-out, remove Cliqz AB…
wlycdgr Sep 24, 2020
653b7d4
GH-2105: Sync button hover states in the hub (#607)
benstrumeyer Sep 25, 2020
52f1a50
GH-2158: Subscription_type ping parameter not sending on login (#606)
benstrumeyer Sep 28, 2020
73318a0
GH-2177: Remove broken page pings (#609)
benstrumeyer Sep 30, 2020
98895ab
GH-2158: Subscription_type ping parameter not sending on login (#610)
benstrumeyer Oct 2, 2020
5b86f6c
GH-2097/t2-to-utm-content-fix (#612)
wlycdgr Oct 2, 2020
eafc209
update translations
christophertino Oct 2, 2020
4f9b05b
udpate travis.yml
christophertino Oct 2, 2020
cfad922
update Changelog
christophertino Oct 2, 2020
3c1a081
update readme
christophertino Oct 2, 2020
45832c2
Fix bug that always made ABTest clients think tests had not been fetc…
wlycdgr Oct 7, 2020
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

GH-2177: Remove broken page pings (#609)
* Remove broken page functionality implemented in GH-1763

* Remove unused imports

Co-authored-by: Christopher Tino <4699516+christophertino@users.noreply.github.com>
  • Loading branch information
benstrumeyer and christophertino committed Sep 30, 2020
commit 73318a0ec88f79f21bc1d9be4cc21761daf1c05a
@@ -108,7 +108,6 @@ const _updateTrackerTrustRestrict = (state, action) => {
sendMessage('setPanelData', {
site_specific_unblocks: updated_site_specific_unblocks,
site_specific_blocks: updated_site_specific_blocks,
brokenPageMetricsTrackerTrustOrUnblock: msg.trust || (!msg.trust && !msg.restrict),
});

return {
@@ -118,7 +118,6 @@ const _updateSitePolicy = (state, action) => {
sendMessage('setPanelData', {
site_whitelist: updated_whitelist,
site_blacklist: updated_blacklist,
brokenPageMetricsWhitelistSite: updated_site_policy === 2,
});

return {
@@ -214,10 +214,7 @@ export function updateTrackerBlocked(state, action) {
});

// persist to background
sendMessage('setPanelData', {
selected_app_ids: updated_app_ids,
brokenPageMetricsTrackerTrustOrUnblock: !blocked
});
sendMessage('setPanelData', { selected_app_ids: updated_app_ids });

return {
categories: updated_categories,
@@ -1214,8 +1214,6 @@ function initializeDispatcher() {
log('Conf value changed for a watched user setting:', key);
}, 200));
dispatcher.on('globals.save.paused_blocking', () => {
// if user has paused Ghostery, suspect broken page
if (globals.SESSION.paused_blocking) { metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_PAUSE); }
// update content script state when blocking is paused/unpaused
cliqz.modules.core.action('refreshAppState');
});
@@ -25,7 +25,6 @@ import conf from './Conf';
import foundBugs from './FoundBugs';
import globals from './Globals';
import latency from './Latency';
import metrics from './Metrics';
import panelData from './PanelData';
import Policy, { BLOCK_REASON_SS_UNBLOCKED, BLOCK_REASON_C2P_ALLOWED_THROUGH } from './Policy';
import PolicySmartBlock from './PolicySmartBlock';
@@ -109,7 +108,6 @@ class EventHandlers {
if (frameId === 0) {
// update reload info before creating/clearing tab info
if (transitionType === 'reload' && !transitionQualifiers.includes('forward_back')) {
metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_REFRESH);
tabInfo.setTabInfo(tabId, 'numOfReloads', tabInfo.getTabInfo(tabId, 'numOfReloads') + 1);
} else if (transitionType !== 'auto_subframe' && transitionType !== 'manual_subframe') {
tabInfo.setTabInfo(tabId, 'reloaded', false);
@@ -539,11 +537,7 @@ class EventHandlers {
*
* @param {Object} tab Details of the tab that was created
*/
static onTabCreated(tab) {
const { url } = tab;

metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_NEW_TAB, url);
}
static onTabCreated() {}

/**
* Handler for tabs.onActivated event.
@@ -73,13 +73,6 @@ class Globals {
this.BLACKLISTED = 1;
this.WHITELISTED = 2;

// Broken page metrics named constants
this.BROKEN_PAGE_REFRESH = 1;
this.BROKEN_PAGE_WHITELIST = 2;
this.BROKEN_PAGE_PAUSE = 3;
this.BROKEN_PAGE_TRACKER_TRUST_OR_UNBLOCK = 4;
this.BROKEN_PAGE_NEW_TAB = 5;

// data stores
this.REDIRECT_MAP = new Map();
this.BLOCKED_REDIRECT_DATA = {};
@@ -14,7 +14,7 @@
import globals from './Globals';
import conf from './Conf';
import { log, prefsSet, prefsGet } from '../utils/common';
import { getActiveTab, processUrlQuery } from '../utils/utils';
import { processUrlQuery } from '../utils/utils';

// CONSTANTS
const FREQUENCIES = { // in milliseconds
@@ -28,11 +28,6 @@ const CAMPAIGN_METRICS = ['install', 'active', 'uninstall'];
const { METRICS_BASE_URL, EXTENSION_VERSION, BROWSER_INFO } = globals;
const MAX_DELAYED_PINGS = 100;

// Note that this threshold is intentionally different from the 30 second threshold in PolicySmartBlock,
// which is used to set the reloaded property on tab objects and to activate smart unblock behavior
// see GH-1797 for more details
const BROKEN_PAGE_METRICS_THRESHOLD = 60000; // 60 seconds

/**
* Class for handling telemetry pings.
* @memberOf BackgroundClasses
@@ -42,13 +37,6 @@ class Metrics {
this.utm_source = '';
this.utm_campaign = '';
this.ping_set = new Set();
this._brokenPageWatcher = {
on: false,
triggerId: '',
triggerTime: '',
timeoutId: null,
url: '',
};
}

/**
@@ -94,75 +82,6 @@ class Metrics {
});
}

/**
* Responds to individual user actions and sequences of user actions that may indicate a broken page,
* sending broken_page pings as needed
* For example, sends a broken_page ping when the user whitelists a site,
* then refreshes the page less than a minute later
* @param {number} triggerId 'what specifically triggered this broken_page ping?' identifier sent along to the metrics server
* @param {string} newTabUrl for checking whether user has opened the same url in a new tab, which confirms a suspicion raised by certain triggers
*/
handleBrokenPageTrigger(triggerId, newTabUrl = null) {
if (this._brokenPageWatcher.on && triggerId === globals.BROKEN_PAGE_REFRESH) {
this.ping('broken_page');
this._unplugBrokenPageWatcher();
return;
}

if (this._brokenPageWatcher.on && triggerId === globals.BROKEN_PAGE_NEW_TAB && this._brokenPageWatcher.url === newTabUrl) {
this.ping('broken_page');
this._unplugBrokenPageWatcher();
return;
}

if (triggerId === globals.BROKEN_PAGE_NEW_TAB) { return; }

this._resetBrokenPageWatcher(triggerId);
}

/**
* handleBrokenPageTrigger helper
* starts the temporary watch for a second suspicious user action in response to a first
* @param {number} triggerId 'what specifically triggered this broken_page ping?' identifier sent along to the metrics server
* @private
*/
_resetBrokenPageWatcher(triggerId) {
this._clearBrokenPageWatcherTimeout();

getActiveTab((tab) => {
const tabUrl = tab && tab.url ? tab.url : '';

this._brokenPageWatcher = {
on: true,
triggerId,
triggerTime: Date.now(),
timeoutId: setTimeout(this._clearBrokenPageWatcherTimeout.bind(this), BROKEN_PAGE_METRICS_THRESHOLD),
url: tabUrl
};
});
}

/**
* handleBrokenPageTrigger helper
* @private
*/
_unplugBrokenPageWatcher() {
this._clearBrokenPageWatcherTimeout();

this._brokenPageWatcher = {
on: false,
triggerId: '',
triggerTime: '',
timeoutId: null,
url: ''
};
}

_clearBrokenPageWatcherTimeout() {
const { timeoutId } = this._brokenPageWatcher;
if (timeoutId) { clearTimeout(timeoutId); }
}

/**
* Prepare data and send telemetry pings.
* @param {string} type type of the telemetry ping
@@ -240,7 +159,6 @@ class Metrics {
case 'priority_support_submit':
case 'theme_change':
case 'manage_subscription':
case 'broken_page':
this._sendReq(type, ['all']);
break;

@@ -390,14 +308,7 @@ class Metrics {
`&us=${encodeURIComponent(this.utm_source)}` +
// Marketing campaign (Former utm_campaign)
`&uc=${encodeURIComponent(this.utm_campaign)}`;
} else if (type === 'broken_page' && this._brokenPageWatcher.on) {
metrics_url +=
// What triggered the broken page ping?
`&setup_path=${encodeURIComponent(this._brokenPageWatcher.triggerId.toString())}` +
// How much time passed between the trigger and the page refresh / open in new tab?
`&setup_block=${encodeURIComponent((Date.now() - this._brokenPageWatcher.triggerTime).toString())}`;
}

return metrics_url;
}

@@ -20,7 +20,6 @@ import conf from './Conf';
import foundBugs from './FoundBugs';
import bugDb from './BugDb';
import globals from './Globals';
import metrics from './Metrics';
import Policy from './Policy';
import tabInfo from './TabInfo';
import Rewards from './Rewards';
@@ -636,14 +635,6 @@ class PanelData {
tabInfo.setTabInfo(this._activeTab.id, 'needsReload', data.needsReload);
}

if (data.brokenPageMetricsTrackerTrustOrUnblock) {
metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_TRACKER_TRUST_OR_UNBLOCK);
}

if (data.brokenPageMetricsWhitelistSite) {
metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_WHITELIST);
}

if (syncSetDataChanged) {
// Push conf changes to the server
account.saveUserSettings().catch(err => log('PanelData saveUserSettings', err));
@@ -224,8 +224,6 @@ class PolicySmartBlock {
static checkReloadThreshold(tabId) {
if (!PolicySmartBlock.shouldCheck(tabId)) { return false; }

// Note that this threshold is different from the broken page ping threshold in Metrics, which is 60 seconds
// see GH-1797 for more details
const SMART_BLOCK_BEHAVIOR_THRESHOLD = 30000; // 30 seconds

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