Bug 1543499 - Record telemetry event when opening the password management UI. r=MattN
authorSam Foster <sfoster@mozilla.com>
Wed, 15 May 2019 23:24:28 +0000
changeset 532837 263b8a0e6c3460e7a7a2c5e9dd90346a7ceefcc6
parent 532836 0ab201cfaf67e1ef4a74c483586764405a79e306
child 532838 df182ef2d4e5a7fe9b44280139ae0fa0d5154d16
push id11272
push userapavel@mozilla.com
push dateThu, 16 May 2019 15:28:22 +0000
treeherdermozilla-beta@2265bfc5920d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1543499
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543499 - Record telemetry event when opening the password management UI. r=MattN * Remove the PWMGR_MANAGE_OPENED histogram and references to it * Add a new pwmgr event category, open_management method and objects for each of the entry points * Expect an entryPoint key to be passed to LoginHelper.openPasswordManager so it can record the event * Update all callers of LoginHelper.openPasswordManager to pass the correct entryPoint key * Record the event in preferences when we open the password management UI as a subdialog * Add test assertions to confirm the telemetry events are recorded, piggybacking on existing tests where practical to avoid duplicating helpers and boilerplate Differential Revision: https://phabricator.services.mozilla.com/D29840
browser/base/content/nsContextMenu.js
browser/base/content/pageinfo/security.js
browser/components/customizableui/content/panelUI.inc.xul
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/tests/browser_password_management.js
toolkit/components/passwordmgr/LoginHelper.jsm
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/LoginManagerParent.jsm
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/test/browser/browser.ini
toolkit/components/passwordmgr/test/browser/browser_autocomplete_footer.js
toolkit/components/passwordmgr/test/browser/browser_context_menu.js
toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js
toolkit/components/passwordmgr/test/browser/browser_openPasswordManager.js
toolkit/components/passwordmgr/test/browser/head.js
toolkit/components/telemetry/Events.yaml
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/docs/data/sync-ping.rst
toolkit/content/widgets/autocomplete-richlistitem.js
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -776,17 +776,20 @@ nsContextMenu.prototype = {
     popup.insertBefore(fragment, insertBeforeElement);
   },
 
   initSyncItems() {
     gSync.updateContentContextMenu(this);
   },
 
   openPasswordManager() {
-    LoginHelper.openPasswordManager(window, gContextMenuContentData.documentURIObject.host);
+    LoginHelper.openPasswordManager(window, {
+      filterString: gContextMenuContentData.documentURIObject.host,
+      entryPoint: "contextmenu",
+    });
   },
 
   inspectNode() {
     return DevToolsShim.inspectNode(gBrowser.selectedTab, this.targetSelectors);
   },
 
   inspectA11Y() {
     return DevToolsShim.inspectA11Y(gBrowser.selectedTab, this.targetSelectors);
--- a/browser/base/content/pageinfo/security.js
+++ b/browser/base/content/pageinfo/security.js
@@ -175,17 +175,20 @@ var security = {
       }
     }
   },
 
   /**
    * Open the login manager window
    */
   viewPasswords() {
-    LoginHelper.openPasswordManager(window, this._getSecurityInfo().hostName);
+    LoginHelper.openPasswordManager(window, {
+      filterString: this._getSecurityInfo().hostName,
+      entryPoint: "pageinfo",
+    });
   },
 
   _cert: null,
 };
 
 function securityOnLoad(uri, windowInfo) {
   security.init(uri, windowInfo);
 
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -331,17 +331,17 @@
         <toolbarbutton id="appMenu-library-button"
                        class="subviewbutton subviewbutton-iconic subviewbutton-nav"
                        label="&places.library.title;"
                        closemenu="none"
                        oncommand="PanelUI.showSubView('appMenu-libraryView', this)"/>
         <toolbarbutton id="appMenu-logins-button"
                        class="subviewbutton subviewbutton-iconic"
                        label="&logins.label;"
-                       oncommand="LoginHelper.openPasswordManager(window)"
+                       oncommand="LoginHelper.openPasswordManager(window, { entryPoint: 'mainmenu' })"
                        />
         <toolbarbutton id="appMenu-addons-button"
                        class="subviewbutton subviewbutton-iconic"
                        label="&addons.label;"
                        key="key_openAddons"
                        command="Tools:Addons"
                        />
         <toolbarbutton id="appMenu-preferences-button"
@@ -420,17 +420,17 @@
 #endif
       </vbox>
     </panelview>
     <panelview id="PanelUI-history" flex="1">
       <vbox class="panel-subview-body">
         <toolbarbutton id="appMenuViewHistorySidebar"
                        label="&appMenuHistory.viewSidebar.label;"
                        label-checked="&appMenuHistory.hideSidebar.label;"
-                       label-unchecked="&appMenuHistory.viewSidebar.label;"                      
+                       label-unchecked="&appMenuHistory.viewSidebar.label;"
                        type="checkbox"
                        class="subviewbutton subviewbutton-iconic"
                        key="key_gotoHistory"
                        oncommand="SidebarUI.toggle('viewHistorySidebar');">
                        <observes element="sidebar-box" attribute="positionend"/>
         </toolbarbutton>
         <toolbarbutton id="appMenuClearRecentHistory"
                        label="&appMenuHistory.clearRecent.label;"
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -289,16 +289,18 @@ var gPrivacyPane = {
     /* Initialize Content Blocking */
     this.initContentBlocking();
 
     this.blockAutoplayReadPrefs();
     this.trackingProtectionReadPrefs();
     this.networkCookieBehaviorReadPrefs();
     this._initTrackingProtectionExtensionControl();
 
+    Services.telemetry.setEventRecordingEnabled("pwmgr", true);
+
     Preferences.get("media.autoplay.default").on("change",
       gPrivacyPane.blockAutoplayReadPrefs.bind(gPrivacyPane));
 
     Preferences.get("privacy.trackingprotection.enabled").on("change",
       gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane));
     Preferences.get("privacy.trackingprotection.pbmode.enabled").on("change",
       gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane));
 
@@ -1417,19 +1419,22 @@ var gPrivacyPane = {
   },
 
   /**
  * Shows the sites where the user has saved passwords and the associated login
  * information.
  */
   showPasswords() {
     if (LoginHelper.managementURI) {
-      window.docShell.messageManager.sendAsyncMessage("PasswordManager:OpenPreferences", {});
+      window.docShell.messageManager.sendAsyncMessage("PasswordManager:OpenPreferences", {
+        entryPoint: "preferences",
+      });
       return;
     }
+    Services.telemetry.recordEvent("pwmgr", "open_management", "preferences");
     gSubDialog.open("chrome://passwordmgr/content/passwordManager.xul");
   },
 
   /**
    * Enables/disables the Exceptions button used to configure sites where
    * passwords are never saved. When browser is set to start in Private
    * Browsing mode, the "Remember passwords" UI is useless, so we disable it.
    */
--- a/browser/components/preferences/in-content/tests/browser_password_management.js
+++ b/browser/components/preferences/in-content/tests/browser_password_management.js
@@ -1,9 +1,12 @@
 "use strict";
+
+ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm", this);
+
 const PM_URL = "chrome://passwordmgr/content/passwordManager.xul";
 const PREF_MANAGEMENT_URI = "signon.management.overrideURI";
 
 var passwordsDialog;
 
 add_task(async function test_setup() {
   Services.logins.removeAllLogins();
 
@@ -16,32 +19,38 @@ add_task(async function test_setup() {
 
   registerCleanupFunction(async function() {
     Services.logins.removeAllLogins();
     Services.prefs.clearUserPref(PREF_MANAGEMENT_URI);
   });
 });
 
 add_task(async function test_openPasswordSubDialog() {
+  Services.telemetry.clearEvents();
   await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
 
   let dialogOpened = promiseLoadSubDialog(PM_URL);
 
   await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
     let doc = content.document;
     let savePasswordCheckBox = doc.getElementById("savePasswords");
     Assert.ok(!savePasswordCheckBox.checked,
               "Save Password CheckBox should be unchecked by default");
     savePasswordCheckBox.click();
 
     let showPasswordsButton = doc.getElementById("showPasswords");
     showPasswordsButton.click();
   });
 
   passwordsDialog = await dialogOpened;
+
+  // check telemetry events while we are in here
+  TelemetryTestUtils.assertEvents(
+    [["pwmgr", "open_management", "preferences"]],
+    {category: "pwmgr", method: "open_management"});
 });
 
 add_task(async function test_deletePasswordWithKey() {
   let doc = passwordsDialog.document;
 
   let tree = doc.getElementById("signonsTree");
   Assert.equal(tree.view.rowCount, 1, "Row count should initially be 1");
   tree.focus();
@@ -55,16 +64,17 @@ add_task(async function test_deletePassw
 
   await TestUtils.waitForCondition(() => tree.view.rowCount == 0);
 
   is_element_visible(content.gSubDialog._dialogs[0]._box,
     "Subdialog is visible after deleting an element");
 });
 
 add_task(async function subdialog_cleanup() {
+  Services.telemetry.clearEvents();
   // Undo the save password change.
   await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
     let doc = content.document;
     let savePasswordCheckBox = doc.getElementById("savePasswords");
     if (savePasswordCheckBox.checked) {
       savePasswordCheckBox.click();
     }
   });
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -33,16 +33,17 @@ var LoginHelper = {
   privateBrowsingCaptureEnabled: null,
   schemeUpgrades: null,
   showAutoCompleteFooter: null,
 
   init() {
     // Watch for pref changes to update cached pref values.
     Services.prefs.addObserver("signon.", () => this.updateSignonPrefs());
     this.updateSignonPrefs();
+    Services.telemetry.setEventRecordingEnabled("pwmgr", true);
   },
 
   updateSignonPrefs() {
     this.autofillForms = Services.prefs.getBoolPref("signon.autofillForms");
     this.autofillAutocompleteOff = Services.prefs.getBoolPref("signon.autofillForms.autocompleteOff");
     this.debug = Services.prefs.getBoolPref("signon.debug");
     this.enabled = Services.prefs.getBoolPref("signon.rememberSignons");
     this.formlessCaptureEnabled = Services.prefs.getBoolPref("signon.formlessCapture.enabled");
@@ -588,21 +589,26 @@ var LoginHelper = {
   },
 
   /**
    * Open the password manager window.
    *
    * @param {Window} window
    *                 the window from where we want to open the dialog
    *
-   * @param {string} [filterString=""]
+   * @param {object?} args
+   *                  params for opening the password manager
+   * @param {string} [args.filterString=""]
    *                 the domain (not origin) to pass to the login manager dialog
    *                 to pre-filter the results
+   * @param {string} args.entryPoint
+   *                 The name of the entry point, used for telemetry
    */
-  openPasswordManager(window, filterString = "") {
+  openPasswordManager(window, { filterString = "", entryPoint = "" } = {}) {
+    Services.telemetry.recordEvent("pwmgr", "open_management", entryPoint);
     if (this.managementURI && window.openTrustedLinkIn) {
       let managementURL = this.managementURI.replace("%DOMAIN%", window.encodeURIComponent(filterString));
       window.openTrustedLinkIn(managementURL, "tab");
       return;
     }
     let win = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
     if (win) {
       win.setFilter(filterString);
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -254,17 +254,20 @@ var LoginManagerContent = {
     let focusedElement = LoginManagerContent._formFillService.focusedInput;
     let eventTarget = LoginManagerContent._keyDownEnterForInput;
     if (!eventTarget || eventTarget !== focusedElement ||
         selectedRowStyle != "loginsFooter") {
       this._keyDownEnterForInput = null;
       return;
     }
     let hostname = eventTarget.ownerDocument.documentURIObject.host;
-    mm.sendAsyncMessage("PasswordManager:OpenPreferences", {hostname});
+    mm.sendAsyncMessage("PasswordManager:OpenPreferences", {
+      hostname,
+      entryPoint: "autocomplete",
+    });
   },
 
   receiveMessage(msg, topWindow) {
     if (msg.name == "PasswordManager:fillForm") {
       this.fillForm({
         topDocument: topWindow.document,
         loginFormOrigin: msg.data.loginFormOrigin,
         loginsFound: LoginHelper.vanillaObjectsToLogins(msg.data.logins),
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -117,17 +117,20 @@ var LoginManagerParent = {
 
       case "PasswordManager:removeLogin": {
         let login = LoginHelper.vanillaObjectToLogin(data.login);
         AutoCompletePopup.removeLogin(login);
         break;
       }
 
       case "PasswordManager:OpenPreferences": {
-        LoginHelper.openPasswordManager(msg.target.ownerGlobal, msg.data.hostname);
+        LoginHelper.openPasswordManager(msg.target.ownerGlobal, {
+          filterString: msg.data.hostname,
+          entryPoint: msg.data.entryPoint,
+        });
         break;
       }
     }
 
     return undefined;
   },
 
   /**
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -94,21 +94,16 @@ function Startup() {
 
   LoadSignons();
 
   // filter the table if requested by caller
   if (window.arguments &&
       window.arguments[0] &&
       window.arguments[0].filterString) {
     setFilter(window.arguments[0].filterString);
-    Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(1);
-    Services.obs.notifyObservers(null, "weave:telemetry:histogram", "PWMGR_MANAGE_OPENED");
-  } else {
-    Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(0);
-    Services.obs.notifyObservers(null, "weave:telemetry:histogram", "PWMGR_MANAGE_OPENED");
   }
 
   FocusFilterBox();
   document.l10n.translateElements(document.querySelectorAll("[data-l10n-id]")).then(
     () => window.sizeToContent());
 }
 
 function watchLoginAutofill() {
--- a/toolkit/components/passwordmgr/test/browser/browser.ini
+++ b/toolkit/components/passwordmgr/test/browser/browser.ini
@@ -48,16 +48,17 @@ skip-if = os == "linux" # Bug 1312981, b
 skip-if = verify
 [browser_username_select_dialog.js]
 support-files =
   subtst_notifications_change_p.html
 [browser_doorhanger_dismissed_for_ccnumber.js]
 [browser_DOMFormHasPassword.js]
 [browser_DOMInputPasswordAdded.js]
 skip-if = (os == "linux") || (os == "mac") # Bug 1337606
+[browser_entry_point_telemetry.js]
 [browser_exceptions_dialog.js]
 [browser_focus_before_first_DOMContentLoaded.js]
 support-files =
   file_focus_before_DOMContentLoaded.sjs
 [browser_formless_submit_chrome.js]
 [browser_hasInsecureLoginForms.js]
 skip-if = verify
 [browser_hasInsecureLoginForms_streamConverter.js]
--- a/toolkit/components/passwordmgr/test/browser/browser_autocomplete_footer.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_autocomplete_footer.js
@@ -73,16 +73,21 @@ add_task(async function test_autocomplet
     EventUtils.synthesizeMouseAtCenter(footer, {});
     let window = await waitForPasswordManagerDialog();
     info("Login dialog was opened");
 
     await TestUtils.waitForCondition(() => {
       return window.document.getElementById("filter").value == "example.com";
     }, "Waiting for the search string to filter logins");
 
+    // Check event telemetry recorded when opening management UI
+    TelemetryTestUtils.assertEvents(
+      [["pwmgr", "open_management", "autocomplete"]],
+      {category: "pwmgr", method: "open_management"});
+
     window.close();
     popup.hidePopup();
   });
 });
 
 add_task(async function test_autocomplete_footer_keydown() {
   let url = TEST_HOSTNAME + BASIC_FORM_PAGE_PATH;
   await BrowserTestUtils.withNewTab({
@@ -108,12 +113,17 @@ add_task(async function test_autocomplet
 
     let window = await waitForPasswordManagerDialog();
     info("Login dialog was opened");
 
     await TestUtils.waitForCondition(() => {
       return window.document.getElementById("filter").value == "example.com";
     }, "Waiting for the search string to filter logins");
 
+    // Check event telemetry recorded when opening management UI
+    TelemetryTestUtils.assertEvents(
+      [["pwmgr", "open_management", "autocomplete"]],
+      {category: "pwmgr", method: "open_management"});
+
     window.close();
     popup.hidePopup();
   });
 });
--- a/toolkit/components/passwordmgr/test/browser/browser_context_menu.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_context_menu.js
@@ -258,16 +258,42 @@ add_task(async function test_context_men
 
         CONTEXT_MENU.hidePopup();
       }
     }
   });
 });
 
 /**
+ * Check event telemetry is correctly recorded when opening the saved logins / management UI
+ * from the context menu
+ */
+add_task(async function test_context_menu_open_management() {
+  Services.prefs.setBoolPref("signon.schemeUpgrades", false);
+  await BrowserTestUtils.withNewTab({
+    gBrowser,
+    url: TEST_HOSTNAME + MULTIPLE_FORMS_PAGE_PATH,
+  }, async function(browser) {
+    await openPasswordContextMenu(browser, "#test-password-1");
+
+    gContextMenu.openPasswordManager();
+    // wait until the management UI opens
+    let dialogWindow = await waitForPasswordManagerDialog();
+    info("Management UI dialog was opened");
+
+    TelemetryTestUtils.assertEvents(
+      [["pwmgr", "open_management", "contextmenu"]],
+      {category: "pwmgr", method: "open_management"});
+
+    dialogWindow.close();
+    CONTEXT_MENU.hidePopup();
+  });
+});
+
+/**
  * Synthesize mouse clicks to open the password manager context menu popup
  * for a target password input element.
  *
  * assertCallback should return true if we should continue or else false.
  */
 async function openPasswordContextMenu(browser, passwordInput, assertCallback = null) {
   let contextMenuShownPromise = BrowserTestUtils.waitForEvent(CONTEXT_MENU, "popupshown");
 
new file mode 100644
--- /dev/null
+++ b/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js
@@ -0,0 +1,81 @@
+const TEST_ORIGIN = "https://example.com";
+
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["signon.rememberSignons.visibilityToggle", true],
+  ]});
+  Services.telemetry.clearEvents();
+});
+
+add_task(async function mainMenu_entryPoint() {
+  await SimpleTest.promiseFocus();
+  info("mainMenu_entryPoint, got focus");
+
+  let mainMenu = document.getElementById("appMenu-popup");
+  let target = document.getElementById("PanelUI-menu-button");
+  await TestUtils.waitForCondition(
+    () => BrowserTestUtils.is_visible(target),
+    "Main menu button should be visible."
+  );
+  info("mainMenu_entryPoint, Main menu button is visible");
+  is(mainMenu.state, "closed", `Menu panel (${mainMenu.id}) is initally closed.`);
+
+  info("mainMenu_entryPoint, clicking target and waiting for popup");
+  let popupshown = BrowserTestUtils.waitForEvent(mainMenu, "popupshown");
+  EventUtils.synthesizeMouseAtCenter(target, {});
+  await popupshown;
+
+  info("mainMenu_entryPoint, main menu popup is shown");
+  is(mainMenu.state, "open", `Menu panel (${mainMenu.id}) is open.`);
+
+  let item = document.getElementById("appMenu-logins-button");
+  await TestUtils.waitForCondition(
+    () => BrowserTestUtils.is_visible(item),
+    "Logins and passwords button is visible."
+  );
+
+  info("mainMenu_entryPoint, clicking on Logins and passwords button");
+  EventUtils.synthesizeMouseAtCenter(item, {});
+  let dialogWindow = await waitForPasswordManagerDialog();
+  info("mainMenu_entryPoint, password manager dialog shown");
+
+  TelemetryTestUtils.assertEvents(
+    [["pwmgr", "open_management", "mainmenu"]],
+    {category: "pwmgr", method: "open_management"});
+
+  info("mainMenu_entryPoint, close dialog and main menu");
+  dialogWindow.close();
+  mainMenu.hidePopup();
+});
+
+add_task(async function pageInfo_entryPoint() {
+  await BrowserTestUtils.withNewTab({
+    gBrowser,
+    url: TEST_ORIGIN,
+  }, async function(browser) {
+    info("pageInfo_entryPoint, opening pageinfo");
+    let pageInfo = BrowserPageInfo(TEST_ORIGIN, "securityTab", {});
+    await BrowserTestUtils.waitForEvent(pageInfo, "load");
+    info("pageInfo_entryPoint, got pageinfo, wait until password button is visible");
+    let passwordsButton = pageInfo.document.getElementById("security-view-password");
+
+    await TestUtils.waitForCondition(
+      () => BrowserTestUtils.is_visible(passwordsButton),
+      "Show passwords button should be visible."
+    );
+    info("pageInfo_entryPoint, clicking the show passwords button...");
+    await SimpleTest.promiseFocus(pageInfo);
+    await EventUtils.synthesizeMouseAtCenter(passwordsButton, {}, pageInfo);
+
+    info("pageInfo_entryPoint, waiting for the passwords manager dialog");
+    let dialogWindow = await waitForPasswordManagerDialog();
+
+    TelemetryTestUtils.assertEvents(
+      [["pwmgr", "open_management", "pageinfo"]],
+      {category: "pwmgr", method: "open_management"});
+
+    info("pageInfo_entryPoint, close dialog and pageInfo");
+    dialogWindow.close();
+    pageInfo.close();
+  });
+});
--- a/toolkit/components/passwordmgr/test/browser/browser_openPasswordManager.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_openPasswordManager.js
@@ -2,29 +2,29 @@ const PREF_MANAGEMENT_URI = "signon.mana
 
 function resetPrefs() {
   Services.prefs.clearUserPref(PREF_MANAGEMENT_URI);
 }
 
 registerCleanupFunction(resetPrefs);
 
 add_task(async function test_noFilter() {
-  LoginHelper.openPasswordManager(window);
+  LoginHelper.openPasswordManager(window, { entryPoint: "mainmenu" });
   let win = await waitForPasswordManagerDialog();
   ok(win, "Login dialog was opened");
   await BrowserTestUtils.closeWindow(win);
   await TestUtils.waitForCondition(() => {
     return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") === null;
   }, "Waiting for the password manager dialog to close");
 });
 
 add_task(async function test_filter() {
   // Greek IDN for example.test
   let domain = "παράδειγμα.δοκιμή";
-  LoginHelper.openPasswordManager(window, domain);
+  LoginHelper.openPasswordManager(window, { filterString: domain, entryPoint: "mainmenu" });
   let win = await waitForPasswordManagerDialog();
   await TestUtils.waitForCondition(() => {
     return win.document.getElementById("filter").value == domain;
   }, "Waiting for the search string to filter logins");
   ok(win, "Login dialog was opened with a domain filter");
   await BrowserTestUtils.closeWindow(win);
   await TestUtils.waitForCondition(() => {
     return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") === null;
@@ -33,26 +33,26 @@ add_task(async function test_filter() {
 
 add_task(async function test_management_overrideURI_noFilter() {
   await SpecialPowers.pushPrefEnv({"set": [
     ["signon.management.page.enabled", true],
   ]});
 
   Services.prefs.setStringPref(PREF_MANAGEMENT_URI, "about:logins?filter=%DOMAIN%");
   let tabOpenPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:logins?filter=");
-  LoginHelper.openPasswordManager(window);
+  LoginHelper.openPasswordManager(window, { entryPoint: "mainmenu" });
   let tab = await tabOpenPromise;
   ok(tab, "Got the new tab");
   BrowserTestUtils.removeTab(tab);
   resetPrefs();
 });
 
 
 add_task(async function test_management_overrideURI_filter() {
   Services.prefs.setStringPref(PREF_MANAGEMENT_URI, "about:logins?filter=%DOMAIN%");
   let tabOpenPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:logins?filter=%CF%80%CE%B1%CF%81%CE%AC%CE%B4%CE%B5%CE%B9%CE%B3%CE%BC%CE%B1.%CE%B4%CE%BF%CE%BA%CE%B9%CE%BC%CE%AE");
   // Greek IDN for example.test
-  LoginHelper.openPasswordManager(window, "παράδειγμα.δοκιμή");
+  LoginHelper.openPasswordManager(window, { filterString: "παράδειγμα.δοκιμή", entryPoint: "mainmenu" });
   let tab = await tabOpenPromise;
   ok(tab, "Got the new tab with a domain filter");
   BrowserTestUtils.removeTab(tab);
   resetPrefs();
 });
--- a/toolkit/components/passwordmgr/test/browser/head.js
+++ b/toolkit/components/passwordmgr/test/browser/head.js
@@ -1,13 +1,14 @@
 const DIRECTORY_PATH = "/browser/toolkit/components/passwordmgr/test/browser/";
 
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm", this);
 ChromeUtils.import("resource://testing-common/LoginTestUtils.jsm", this);
 ChromeUtils.import("resource://testing-common/ContentTaskUtils.jsm", this);
+ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm", this);
 
 add_task(async function common_initialize() {
   await SpecialPowers.pushPrefEnv({"set": [["signon.rememberSignons", true]]});
 });
 
 registerCleanupFunction(async function cleanup_removeAllLoginsAndResetRecipes() {
   await SpecialPowers.popPrefEnv();
 
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -372,16 +372,28 @@ normandy:
       Sent when a preference rollout ends due to the rolled-out
       preference becoming a new default.
     bug_numbers: [1443560]
     notification_emails: ["normandy-notifications@mozilla.com"]
     record_in_processes: [main]
     release_channel_collection: opt-out
     expiry_version: never
 
+pwmgr:
+  open_management:
+    objects: ["autocomplete", "capturedoorhanger", "contextmenu", "pageinfo", "preferences", "mainmenu"]
+    methods: ["open_management"]
+    description: >
+      Sent when opening the password management UI.
+    bug_numbers: [1543499, 1454733, 1545172]
+    notification_emails: ["loines@mozilla.com", "passwords-dev@mozilla.org", "sfoster@mozilla.com"]
+    record_in_processes: [main]
+    release_channel_collection: opt-out
+    expiry_version: never
+
 fxa_avatar_menu:
   click:
     objects: [
       "account_settings",
       "cad",
       "login",
       "send_tab",
       "sync_now",
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -12163,27 +12163,16 @@
     "record_into_store": ["main", "pre-account"]
   },
   "PWMGR_MANAGE_DELETED_ALL": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "kind": "count",
     "description": "Count of times that Remove All was used from the password management interface"
   },
-  "PWMGR_MANAGE_OPENED": {
-    "record_in_processes": ["main"],
-    "expires_in_version": "never",
-    "kind": "enumerated",
-    "n_values" : 5,
-    "description": "Accumulates how the password management interface was opened. (0=Preferences, 1=Page Info)",
-    "alert_emails": ["loines@mozilla.com"],
-    "bug_numbers": [1454733, 1545172],
-    "releaseChannelCollection": "opt-out",
-    "record_into_store": ["main", "pre-account"]
-  },
   "PWMGR_MANAGE_SORTED": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "keyed": true,
     "kind": "count",
     "description": "Reports the column that logins are sorted by"
   },
   "PWMGR_MANAGE_VISIBILITY_TOGGLED": {
--- a/toolkit/components/telemetry/docs/data/sync-ping.rst
+++ b/toolkit/components/telemetry/docs/data/sync-ping.rst
@@ -214,17 +214,16 @@ Currently, the histograms that can be in
 
 PWMGR_BLOCKLIST_NUM_SITES
 PWMGR_FORM_AUTOFILL_RESULT
 PWMGR_LOGIN_LAST_USED_DAYS
 PWMGR_LOGIN_PAGE_SAFETY
 PWMGR_MANAGE_COPIED_PASSWORD
 PWMGR_MANAGE_COPIED_USERNAME
 PWMGR_MANAGE_DELETED
-PWMGR_MANAGE_OPENED
 PWMGR_MANAGE_VISIBILITY_TOGGLED
 PWMGR_NUM_PASSWORDS_PER_HOSTNAME
 PWMGR_NUM_SAVED_PASSWORDS
 PWMGR_PROMPT_REMEMBER_ACTION
 PWMGR_PROMPT_UPDATE_ACTION
 PWMGR_SAVING_ENABLED
 
 Histograms are objects with the following 6 properties:
--- a/toolkit/content/widgets/autocomplete-richlistitem.js
+++ b/toolkit/content/widgets/autocomplete-richlistitem.js
@@ -983,17 +983,20 @@ class MozAutocompleteRichlistitemLoginsF
   constructor() {
     super();
 
     function handleEvent(event) {
       if (event.button != 0) {
         return;
       }
 
-      LoginHelper.openPasswordManager(this.ownerGlobal, this._data.hostname);
+      LoginHelper.openPasswordManager(this.ownerGlobal, {
+        filterString: this._data.hostname,
+        entryPoint: "autocomplete",
+      });
     }
 
     this.addEventListener("click", handleEvent);
   }
 
   get _data() {
     return JSON.parse(this.getAttribute("ac-value"));
   }