Backed out changeset a2e4d687840d (bug 1429016) for build bustages at Notification.cpp on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Wed, 13 Feb 2019 03:33:48 +0200
changeset 458834 17fb1009195f
parent 458833 0379792adfbb
child 458835 e957d571c91c
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1429016
milestone67.0a1
backs outa2e4d687840d
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
Backed out changeset a2e4d687840d (bug 1429016) for build bustages at Notification.cpp on a CLOSED TREE
browser/components/preferences/in-content/privacy.js
dom/notification/Notification.cpp
toolkit/components/alerts/resources/content/alert.js
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/histogram-whitelists.json
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -1088,16 +1088,21 @@ var gPrivacyPane = {
    * Displays the notifications exceptions dialog where specific site notification
    * preferences can be set.
    */
   showNotificationExceptions() {
     let params = { permissionType: "desktop-notification" };
 
     gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
       "resizable=yes", params);
+
+    try {
+      Services.telemetry
+        .getHistogramById("WEB_NOTIFICATION_EXCEPTIONS_OPENED").add();
+    } catch (e) { }
   },
 
 
   // MEDIA
 
   blockAutoplayReadPrefs() {
     let blocked =
       Preferences.get("media.autoplay.default").value == Ci.nsIAutoplay.BLOCKED;
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -618,16 +618,21 @@ void NotificationTelemetryService::Recor
     rv = enumerator->GetNext(getter_AddRefs(supportsPermission));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
     }
     uint32_t capability;
     if (!GetNotificationPermission(supportsPermission, &capability)) {
       continue;
     }
+    if (capability == nsIPermissionManager::DENY_ACTION) {
+      Telemetry::Accumulate(Telemetry::WEB_NOTIFICATION_PERMISSIONS, 0);
+    } else if (capability == nsIPermissionManager::ALLOW_ACTION) {
+      Telemetry::Accumulate(Telemetry::WEB_NOTIFICATION_PERMISSIONS, 1);
+    }
   }
 }
 
 bool NotificationTelemetryService::GetNotificationPermission(
     nsISupports* aSupports, uint32_t* aCapability) {
   nsCOMPtr<nsIPermission> permission = do_QueryInterface(aSupports);
   if (!permission) {
     return false;
@@ -1119,26 +1124,30 @@ class NotificationClickWorkerRunnable fi
 };
 
 NS_IMETHODIMP
 NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
                               const char16_t* aData) {
   AssertIsOnMainThread();
 
   if (!strcmp("alertdisablecallback", aTopic)) {
+    Telemetry::Accumulate(Telemetry::WEB_NOTIFICATION_MENU, 1);
     if (XRE_IsParentProcess()) {
       return Notification::RemovePermission(mPrincipal);
     }
     // Permissions can't be removed from the content process. Send a message
     // to the parent; `ContentParent::RecvDisableNotifications` will call
     // `RemovePermission`.
     ContentChild::GetSingleton()->SendDisableNotifications(
         IPC::Principal(mPrincipal));
     return NS_OK;
-  } 
+  } else if (!strcmp("alertclickcallback", aTopic)) {
+    Telemetry::Accumulate(Telemetry::WEB_NOTIFICATION_CLICKED, 1);
+  } else if (!strcmp("alertsettingscallback", aTopic)) {
+    Telemetry::Accumulate(Telemetry::WEB_NOTIFICATION_MENU, 2);
     if (XRE_IsParentProcess()) {
       return Notification::OpenSettings(mPrincipal);
     }
     // `ContentParent::RecvOpenNotificationSettings` notifies observers in the
     // parent process.
     ContentChild::GetSingleton()->SendOpenNotificationSettings(
         IPC::Principal(mPrincipal));
     return NS_OK;
@@ -1146,16 +1155,21 @@ NotificationObserver::Observe(nsISupport
     RefPtr<NotificationTelemetryService> telemetry =
         NotificationTelemetryService::GetInstance();
     if (telemetry) {
       // Record whether "do not disturb" is supported after the first
       // notification, to account for falling back to XUL alerts.
       telemetry->RecordDNDSupported();
     }
     Unused << NS_WARN_IF(NS_FAILED(AdjustPushQuota(aTopic)));
+
+    if (!strcmp("alertshow", aTopic)) {
+      // Record notifications actually shown (e.g. don't count if DND is on).
+      Telemetry::Accumulate(Telemetry::WEB_NOTIFICATION_SHOWN, 1);
+    }
   }
 
   return mObserver->Observe(aSubject, aTopic, aData);
 }
 
 nsresult NotificationObserver::AdjustPushQuota(const char* aTopic) {
   nsCOMPtr<nsIPushQuotaManager> pushQuotaManager =
       do_GetService("@mozilla.org/push/Service;1");
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -281,16 +281,18 @@ function onAlertClick() {
   }
 }
 
 function doNotDisturb() {
   const alertService = Cc["@mozilla.org/alerts-service;1"]
                          .getService(Ci.nsIAlertsService)
                          .QueryInterface(Ci.nsIAlertsDoNotDisturb);
   alertService.manualDoNotDisturb = true;
+  Services.telemetry.getHistogramById("WEB_NOTIFICATION_MENU")
+                    .add(0);
   onAlertClose();
 }
 
 function disableForOrigin() {
   gAlertListener.observe(null, "alertdisablecallback", gAlertCookie);
   onAlertClose();
 }
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -12578,16 +12578,43 @@
     "record_in_processes": ["main", "content", "gpu"],
     "alert_emails": ["gfx-telemetry-alerts@mozilla.com", "rhunt@mozilla.com"],
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 100,
     "releaseChannelCollection": "opt-out",
     "description": "Graphics Crash Reason (...)"
   },
+  "WEB_NOTIFICATION_CLICKED": {
+    "record_in_processes": ["main", "content"],
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["firefox-dev@mozilla.org", "push@mozilla.com"],
+    "bug_numbers": [1225336, 1429286],
+    "expires_in_version": "never",
+    "kind": "count",
+    "description": "Count of times a web notification was clicked"
+  },
+  "WEB_NOTIFICATION_MENU": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["firefox-dev@mozilla.org"],
+    "bug_numbers": [1225336],
+    "expires_in_version": "50",
+    "kind": "enumerated",
+    "n_values": 5,
+    "description": "Count of times a contextual menu item was used from a Notification (0: DND, 1: Disable, 2: Settings)"
+  },
+  "WEB_NOTIFICATION_SHOWN": {
+    "record_in_processes": ["main", "content"],
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["firefox-dev@mozilla.org", "push@mozilla.com"],
+    "bug_numbers": [1225336, 1429286],
+    "expires_in_version": "never",
+    "kind": "count",
+    "description": "Count of times a Notification was rendered (accounting for XUL DND). A system backend may put the notification directly into the tray if its own DND is on."
+  },
   "WEBFONT_DOWNLOAD_TIME": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["jdaggett@mozilla.com"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 60000,
     "n_buckets": 50,
     "description": "Time to download a webfont (ms)"
@@ -12677,16 +12704,34 @@
   "ALERTS_SERVICE_DND_SUPPORTED_FLAG": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["firefox-dev@mozilla.org"],
     "bug_numbers": [1219030],
     "expires_in_version": "50",
     "kind": "flag",
     "description": "Whether the do not disturb option is supported. True if the browser uses XUL alerts."
   },
+  "WEB_NOTIFICATION_EXCEPTIONS_OPENED": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["firefox-dev@mozilla.org"],
+    "bug_numbers": [1219030],
+    "expires_in_version": "50",
+    "kind": "count",
+    "description": "Number of times the Notification Permissions dialog has been opened."
+  },
+  "WEB_NOTIFICATION_PERMISSIONS": {
+    "record_in_processes": ["main", "content"],
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["firefox-dev@mozilla.org", "push@mozilla.com"],
+    "bug_numbers": [1219030, 1429286],
+    "expires_in_version": "never",
+    "kind": "enumerated",
+    "n_values": 10,
+    "description": "Number of origins with the web notifications permission (0 = denied, 1 = allowed)."
+  },
   "PLUGIN_DRAWING_MODEL": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["gfx-telemetry-alerts@mozilla.com", "rhunt@mozilla.com"],
     "expires_in_version": "never",
     "kind": "enumerated",
     "bug_numbers": [1229961],
     "n_values": 12,
     "releaseChannelCollection": "opt-out",
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -1555,11 +1555,14 @@
     "UPDATE_SERVICE_MANUALLY_UNINSTALLED_EXTERNAL",
     "UPDATE_SERVICE_MANUALLY_UNINSTALLED_NOTIFY",
     "UPDATE_UNABLE_TO_APPLY_EXTERNAL",
     "UPDATE_UNABLE_TO_APPLY_NOTIFY",
     "VIDEO_FASTSEEK_USED",
     "WEBFONT_PER_PAGE",
     "WEBRTC_CALL_COUNT_2",
     "WEBVTT_USED_VTT_CUES",
+    "WEB_NOTIFICATION_CLICKED",
+    "WEB_NOTIFICATION_EXCEPTIONS_OPENED",
+    "WEB_NOTIFICATION_SHOWN",
     "XUL_CACHE_DISABLED"
   ]
 }