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

(8.5.4) GH-2153: Future-proof metrics uninstall URL #615

Merged
merged 7 commits into from Oct 26, 2020

Group METRICS_URL_SET with other consts

  • Loading branch information
leuryr committed Oct 5, 2020
commit 5cb054329e81bf48886f2ba0fa0ffa4cb50c8e9f
@@ -27,6 +27,16 @@ const CRITICAL_METRICS = ['install', 'install_complete', 'upgrade', 'active', 'e
const CAMPAIGN_METRICS = ['install', 'active', 'uninstall'];
const { METRICS_BASE_URL, EXTENSION_VERSION, BROWSER_INFO } = globals;
const MAX_DELAYED_PINGS = 100;
// Set of conf keys used in constructing telemetry url
const METRICS_URL_SET = new Set([
'enable_human_web',
'enable_offers',
'account',
'enable_metrics',
'show_alert',
'alert_expanded',
'show_cmp'
]);

/**
* Class for handling telemetry pings.
@@ -190,19 +200,7 @@ class Metrics {
* @param {string} conf key being changed
*/
setUninstallUrl(key) {
if (typeof chrome.runtime.setUninstallURL === 'function') {
// Set of conf keys used in constructing telemetry url
const METRICS_URL_SET = new Set([
'enable_human_web',
'enable_offers',
'account',
'enable_metrics',
'show_alert',
'alert_expanded',
'show_cmp'
]);

if (!key || METRICS_URL_SET.has(key)) {
if (typeof chrome.runtime.setUninstallURL === 'function' && (!key || METRICS_URL_SET.has(key))) {
const metrics_url = this._buildMetricsUrl('uninstall');
if (metrics_url.length) {
chrome.runtime.setUninstallURL(metrics_url);
@@ -216,7 +214,7 @@ class Metrics {
*
* @private
*
* @since 8.5.3
* @since 8.5.4
* @param {string} query param to be included in string
* @param {string} value number value to be passed on through qeury string
* @return {string} complete query component
ProTip! Use n and p to navigate between commits in a pull request.