From c20aaa3bd9e7bf894319fb11b21cdb4eb3893ca4 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Thu, 9 Dec 2021 07:58:19 +0000 Subject: [PATCH] Bug 1744591 - Stop collecting telemetry for hidden browser.link.open_newwindow.restriction preference usage. r=chutten Differential Revision: https://phabricator.services.mozilla.com/D133010 --- browser/components/BrowserGlue.jsm | 18 ------- browser/components/metrics.yaml | 15 ------ ...serGlue_newwindow_restriction_telemetry.js | 49 ------------------- browser/components/tests/unit/xpcshell.ini | 2 - 4 files changed, 84 deletions(-) delete mode 100644 browser/components/tests/unit/test_browserGlue_newwindow_restriction_telemetry.js diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm index bfbe5119866c..97172158a09a 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/BrowserGlue.jsm @@ -17,8 +17,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); -Cu.importGlobalProperties(["Glean"]); - XPCOMUtils.defineLazyModuleGetters(this, { AboutNewTab: "resource:///modules/AboutNewTab.jsm", ActorManagerParent: "resource://gre/modules/ActorManagerParent.jsm", @@ -1097,8 +1095,6 @@ BrowserGlue.prototype = { } } else if (data == "add-breaches-sync-handler") { this._addBreachesSyncHandler(); - } else if (data == "new-window-restriction-telemetry") { - this._collectNewWindowRestrictionTelemetry(); } break; case "initial-migration-will-import-default-bookmarks": @@ -2698,12 +2694,6 @@ BrowserGlue.prototype = { }, }, - { - task: () => { - this._collectNewWindowRestrictionTelemetry(); - }, - }, - // WebDriver components (Remote Agent and Marionette) need to be // initialized as very last step. { @@ -4532,14 +4522,6 @@ BrowserGlue.prototype = { } }, - _collectNewWindowRestrictionTelemetry() { - let restrictionPref = Services.prefs.getIntPref( - "browser.link.open_newwindow.restriction", - 2 - ); - Glean.browserLink.openNewwindowRestriction.set(restrictionPref); - }, - QueryInterface: ChromeUtils.generateQI([ "nsIObserver", "nsISupportsWeakReference", diff --git a/browser/components/metrics.yaml b/browser/components/metrics.yaml index c1be591ea438..0acb5015901d 100644 --- a/browser/components/metrics.yaml +++ b/browser/components/metrics.yaml @@ -4,18 +4,3 @@ --- $schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 - -browser.link: - open_newwindow_restriction: - type: quantity - description: > - browser.link.open_newwindow.restriction preference value, that is one of - 0, 1, or 2, where 2 is desktop default - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1740063 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1740063#c6 - notification_emails: - - tfujisawa.birchill@mozilla.com - expires: "97" - unit: "-" diff --git a/browser/components/tests/unit/test_browserGlue_newwindow_restriction_telemetry.js b/browser/components/tests/unit/test_browserGlue_newwindow_restriction_telemetry.js deleted file mode 100644 index 445c64de0732..000000000000 --- a/browser/components/tests/unit/test_browserGlue_newwindow_restriction_telemetry.js +++ /dev/null @@ -1,49 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService( - Ci.nsIObserver -); - -Cu.importGlobalProperties(["Glean"]); - -const RESTRICTION_PREF = "browser.link.open_newwindow.restriction"; - -function collectTelemetry() { - gBrowserGlue.observe( - null, - "browser-glue-test", - "new-window-restriction-telemetry" - ); -} - -add_task(async function() { - Services.fog.initializeFOG(); - - Services.prefs.setIntPref(RESTRICTION_PREF, 0); - collectTelemetry(); - Assert.equal(Glean.browserLink.openNewwindowRestriction.testGetValue(), 0); - - Services.prefs.setIntPref(RESTRICTION_PREF, 1); - collectTelemetry(); - Assert.equal(Glean.browserLink.openNewwindowRestriction.testGetValue(), 1); - - Services.prefs.setIntPref(RESTRICTION_PREF, 2); - collectTelemetry(); - Assert.equal(Glean.browserLink.openNewwindowRestriction.testGetValue(), 2); - - // Test 0 again to verify that 0 above wasn't garbage data, and also as a - // preparetion for the next default pref test. - Services.prefs.setIntPref(RESTRICTION_PREF, 0); - collectTelemetry(); - Assert.equal(Glean.browserLink.openNewwindowRestriction.testGetValue(), 0); - - Services.prefs.clearUserPref(RESTRICTION_PREF); - collectTelemetry(); - Assert.equal(Glean.browserLink.openNewwindowRestriction.testGetValue(), 2); -}); - -registerCleanupFunction(function() { - Services.prefs.clearUserPref(RESTRICTION_PREF); -}); diff --git a/browser/components/tests/unit/xpcshell.ini b/browser/components/tests/unit/xpcshell.ini index 9af9f86d7fd4..1b5dcc863cf5 100644 --- a/browser/components/tests/unit/xpcshell.ini +++ b/browser/components/tests/unit/xpcshell.ini @@ -11,5 +11,3 @@ support-files = [test_distribution_cachedexistence.js] [test_browserGlue_migration_no_errors.js] [test_browserGlue_migration_social_cleanup.js] -[test_browserGlue_newwindow_restriction_telemetry.js] -skip-if = true #Bug 1744591