Commit bb95e9b0 authored by Nick Alexander's avatar Nick Alexander
Browse files

Bug 1788960 - Part 2: Telemetry event when completing chrome-privileged...

Bug 1788960 - Part 2: Telemetry event when completing chrome-privileged Windows native notification with `name`. r=chutten

This allows to connect a `backgroundTaskMessage` popping a toast
notification with a given `name` through to a re-engagement with
Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D156637
parent ae5109c1
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -1032,17 +1032,27 @@ nsDefaultCommandLineHandler.prototype = {
      while (
        (tag = cmdLine.handleFlagWithParam("notification-windowsTag", false))
      ) {
        let onUnknownWindowsTag = (unknownTag, launchUrl) => {
          if (!launchUrl) {
        let onUnknownWindowsTag = (unknownTag, launchUrl, privilegedName) => {
          console.info(
              `Completing Windows notification with tag '${unknownTag}' with no associated launchUrl`
            `Completing Windows notification (tag=${JSON.stringify(
              unknownTag
            )}, launchUrl=${JSON.stringify(
              launchUrl
            )}, privilegedName=${JSON.stringify(privilegedName)}))`
          );
          if (privilegedName) {
            Services.telemetry.setEventRecordingEnabled(
              "browser.launched_to_handle",
              true
            );
            Glean.browserLaunchedToHandle.systemNotification.record({
              name: privilegedName,
            });
          }
          if (!launchUrl) {
            return;
          }
          let uri = resolveURIInternal(cmdLine, launchUrl);
          console.info(
            `Opening ${uri.spec} to complete Windows notification with tag '${unknownTag}'`
          );
          urilist.push(uri);
        };

+29 −0
Original line number Diff line number Diff line
@@ -9,3 +9,32 @@
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
$tags:
  - 'Firefox :: General'

browser.launched_to_handle:
  system_notification:
    type: event
    description: >
      Recorded when Firefox launches to complete a native notification popped by
      a system (chrome privileged) alert.  Windows-only at the time of writing.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1788960
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1788960#c10
    data_sensitivity:
      - interaction
    notification_emails:
      - nalexander@mozilla.com
      - rtestard@mozilla.com
    expires: never
    extra_keys:
      name:
        description: >
          The `name` of the system (chrome privileged) alert that Firefox was
          launched to complete.
        type: string
      action:
        description: >
          The `action` of the system (chrome privileged) alert that Firefox was
          launched to complete.
        type: string
    telemetry_mirror: BrowserLaunched_to_handle_SystemNotification_Toast
+24 −0
Original line number Diff line number Diff line
@@ -991,6 +991,30 @@ normandy:
      branch: If reason == invalid-branch, the branch that failed validation.
      feature: If reason == invalid-feature, the invalid feature ID.

browser.launched_to_handle:
  system_notification:
    objects: ["toast"]
    description: >
      Recorded when Firefox launches to complete a native notification popped by
      a system (chrome privileged) alert.  Windows-only at the time of writing.
    bug_numbers:
      - 1788960
    notification_emails:
      - nalexander@mozilla.com
      - rtestard@mozilla.com
    products:
      - "firefox"
    record_in_processes: [main]
    release_channel_collection: opt-out
    expiry_version: never
    extra_keys:
      name: >
        The `name` of the system (chrome privileged) alert that Firefox was
        launched to complete.
      action: >
        The `action` of the system (chrome privileged) alert that Firefox was
        launched to complete.

pwmgr:
  open_management:
    objects: ["aboutprotections", "autocomplete", "capturedoorhanger", "contextmenu", "direct", "fxamenu", "mainmenu", "pageinfo", "preferences", "snippet"]