--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -637,18 +637,16 @@ NotificationPermissionRequest::ResolvePr
// or "denied" otherwise.
mPermission = Notification::TestPermission(mPrincipal);
}
if (mCallback) {
ErrorResult error;
mCallback->Call(mPermission, error);
rv = error.StealNSResult();
}
- Telemetry::Accumulate(
- Telemetry::WEB_NOTIFICATION_REQUEST_PERMISSION_CALLBACK, !!mCallback);
mPromise->MaybeResolve(mPermission);
return rv;
}
NS_IMETHODIMP
NotificationPermissionRequest::GetTypes(nsIArray** aTypes)
{
nsTArray<nsString> emptyOptions;
--- a/dom/push/Push.js
+++ b/dom/push/Push.js
@@ -87,18 +87,16 @@ Push.prototype = {
this._requestPermission(resolve, permissionDenied);
}
});
},
subscribe: function(options) {
console.debug("subscribe()", this._scope);
- let histogram = Services.telemetry.getHistogramById("PUSH_API_USED");
- histogram.add(true);
return this.askPermission().then(() =>
this.createPromise((resolve, reject) => {
let callback = new PushSubscriptionCallback(this, resolve, reject);
if (!options || options.applicationServerKey === null) {
PushService.subscribe(this._scope, this._principal, callback);
return;
}
@@ -194,31 +192,21 @@ Push.prototype = {
let typeArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
typeArray.appendElement(type, false);
// create a nsIContentPermissionRequest
let request = {
types: typeArray,
principal: this._principal,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
- allow: function() {
- let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_GRANTED");
- histogram.add();
- allowCallback();
- },
- cancel: function() {
- let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_DENIED");
- histogram.add();
- cancelCallback();
- },
+ allow: allowCallback,
+ cancel: cancelCallback,
window: this._window,
};
- let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_REQUESTED");
- histogram.add(1);
// Using askPermission from nsIDOMWindowUtils that takes care of the
// remoting if needed.
let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowUtils.askPermission(request);
},
};
--- a/dom/push/PushRecord.jsm
+++ b/dom/push/PushRecord.jsm
@@ -80,17 +80,16 @@ PushRecord.prototype = {
// notification, reset the quota. `Math.max(0, ...)` ensures the
// last visit date isn't in the future.
let daysElapsed =
Math.max(0, (Date.now() - lastVisit) / 24 / 60 / 60 / 1000);
this.quota = Math.min(
Math.round(8 * Math.pow(daysElapsed, -0.8)),
prefs.get("maxQuotaPerSubscription")
);
- Services.telemetry.getHistogramById("PUSH_API_QUOTA_RESET_TO").add(this.quota);
}
},
receivedPush(lastVisit) {
this.updateQuota(lastVisit);
this.pushCount++;
this.lastPush = Date.now();
},
@@ -118,21 +117,16 @@ PushRecord.prototype = {
return this.recentMessageIDs && this.recentMessageIDs.includes(id);
},
reduceQuota() {
if (!this.quotaApplies()) {
return;
}
this.quota = Math.max(this.quota - 1, 0);
- // We check for ctime > 0 to skip older records that did not have ctime.
- if (this.isExpired() && this.ctime > 0) {
- let duration = Date.now() - this.ctime;
- Services.telemetry.getHistogramById("PUSH_API_QUOTA_EXPIRATION_TIME").add(duration / 1000);
- }
},
/**
* Queries the Places database for the last time a user visited the site
* associated with a push registration.
*
* @returns {Promise} A promise resolved with either the last time the user
* visited the site, or `-Infinity` if the site is not in the user's history.
--- a/dom/push/PushService.jsm
+++ b/dom/push/PushService.jsm
@@ -52,26 +52,16 @@ const prefs = new Preferences("dom.push.
const PUSH_SERVICE_UNINIT = 0;
const PUSH_SERVICE_INIT = 1; // No serverURI
const PUSH_SERVICE_ACTIVATING = 2;//activating db
const PUSH_SERVICE_CONNECTION_DISABLE = 3;
const PUSH_SERVICE_ACTIVE_OFFLINE = 4;
const PUSH_SERVICE_RUNNING = 5;
-// Telemetry failure to send push notification to Service Worker reasons.
-// Key not found in local database.
-const kDROP_NOTIFICATION_REASON_KEY_NOT_FOUND = 0;
-// User cleared history.
-const kDROP_NOTIFICATION_REASON_NO_HISTORY = 1;
-// Version of message received not newer than previous one.
-const kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT = 2;
-// Subscription has expired.
-const kDROP_NOTIFICATION_REASON_EXPIRED = 3;
-
/**
* State is change only in couple of functions:
* init - change state to PUSH_SERVICE_INIT if state was PUSH_SERVICE_UNINIT
* changeServerURL - change state to PUSH_SERVICE_ACTIVATING if serverURL
* present or PUSH_SERVICE_INIT if not present.
* changeStateConnectionEnabledEvent - it is call on pref change or during
* the service activation and it can
* change state to
@@ -655,18 +645,16 @@ this.PushService = {
return true;
});
},
_notifySubscriptionChangeObservers: function(record) {
if (!record) {
return;
}
-
- Services.telemetry.getHistogramById("PUSH_API_NOTIFY_REGISTRATION_LOST").add();
gPushNotifier.notifySubscriptionChange(record.scope, record.principal);
},
/**
* Drops a registration and notifies the associated service worker. If the
* registration does not exist, this function is a no-op.
*
* @param {String} keyID The registration ID to remove.
@@ -730,22 +718,16 @@ this.PushService = {
return record;
});
}, error => {
return this.dropRegistrationAndNotifyApp(record.keyID).then(
() => Promise.reject(error));
});
},
- _recordDidNotNotify: function(reason) {
- Services.telemetry.
- getHistogramById("PUSH_API_NOTIFICATION_RECEIVED_BUT_DID_NOT_NOTIFY").
- add(reason);
- },
-
/**
* Dispatches an incoming message to a service worker, recalculating the
* quota for the associated push registration. If the quota is exceeded,
* the registration and message will be dropped, and the worker will not
* be notified.
*
* @param {String} keyID The push registration ID.
* @param {String} messageID The message ID, used to report service worker
@@ -758,17 +740,16 @@ this.PushService = {
* function returns `null` or `undefined`, the record will not be updated.
* `PushServiceWebSocket` uses this to drop incoming updates with older
* versions.
* @returns {Promise} Resolves with an `nsIPushErrorReporter` ack status
* code, indicating whether the message was delivered successfully.
*/
receivedPushMessage(keyID, messageID, headers, data, updateFunc) {
console.debug("receivedPushMessage()");
- Services.telemetry.getHistogramById("PUSH_API_NOTIFICATION_RECEIVED").add();
return this._updateRecordAfterPush(keyID, updateFunc).then(record => {
if (record.quotaApplies()) {
// Update quota after the delay, at which point
// we check for visible notifications.
let timeoutID = setTimeout(_ =>
{
this._updateQuota(keyID);
@@ -791,34 +772,31 @@ this.PushService = {
* @param {String} keyID The push registration ID.
* @param {Function} updateFunc The function passed to `receivedPushMessage`.
* @returns {Promise} Resolves with the updated record, or rejects if the
* record was not updated.
*/
_updateRecordAfterPush(keyID, updateFunc) {
return this.getByKeyID(keyID).then(record => {
if (!record) {
- this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_KEY_NOT_FOUND);
throw new Error("No record for key ID " + keyID);
}
return record.getLastVisit().then(lastVisit => {
// As a special case, don't notify the service worker if the user
// cleared their history.
if (!isFinite(lastVisit)) {
- this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_HISTORY);
throw new Error("Ignoring message sent to unvisited origin");
}
return lastVisit;
}).then(lastVisit => {
// Update the record, resetting the quota if the user has visited the
// site since the last push.
return this._db.update(keyID, record => {
let newRecord = updateFunc(record);
if (!newRecord) {
- this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT);
return null;
}
// Because `unregister` is advisory only, we can still receive messages
// for stale Simple Push registrations from the server. To work around
// this, we check if the record has expired before *and* after updating
// the quota.
if (newRecord.isExpired()) {
return null;
@@ -872,17 +850,16 @@ this.PushService = {
// If there are visible notifications, don't apply the quota penalty
// for the message.
if (record.uri && !this._visibleNotifications.has(record.uri.prePath)) {
record.reduceQuota();
}
return record;
}).then(record => {
if (record.isExpired()) {
- this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_EXPIRED);
// Drop the registration in the background. If the user returns to the
// site, the service worker will be notified on the next `idle-daily`
// event.
this._backgroundUnregister(record,
Ci.nsIPushErrorReporter.UNSUBSCRIBE_QUOTA_EXCEEDED);
} else {
gPushNotifier.notifySubscriptionModified(record.scope,
record.principal);
@@ -999,70 +976,57 @@ this.PushService = {
/**
* Called on message from the child process. aPageRecord is an object sent by
* the push manager, identifying the sending page and other fields.
*/
_registerWithServer: function(aPageRecord) {
console.debug("registerWithServer()", aPageRecord);
- Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_ATTEMPT").add();
return this._sendRequest("register", aPageRecord)
.then(record => this._onRegisterSuccess(record),
err => this._onRegisterError(err))
.then(record => {
this._deletePendingRequest(aPageRecord);
gPushNotifier.notifySubscriptionModified(record.scope,
record.principal);
return record.toSubscription();
}, err => {
this._deletePendingRequest(aPageRecord);
throw err;
});
},
_sendUnregister(aRecord, aReason) {
- Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_ATTEMPT").add();
- return this._sendRequest("unregister", aRecord, aReason).then(function(v) {
- Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_SUCCEEDED").add();
- return v;
- }).catch(function(e) {
- Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_FAILED").add();
- return Promise.reject(e);
- });
+ return this._sendRequest("unregister", aRecord, aReason);
},
/**
* Exceptions thrown in _onRegisterSuccess are caught by the promise obtained
* from _service.request, causing the promise to be rejected instead.
*/
_onRegisterSuccess: function(aRecord) {
console.debug("_onRegisterSuccess()");
return this._db.put(aRecord)
- .then(record => {
- Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_SUCCEEDED").add();
- return record;
- })
.catch(error => {
- Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
// Unable to save. Destroy the subscription in the background.
this._backgroundUnregister(aRecord,
Ci.nsIPushErrorReporter.UNSUBSCRIBE_MANUAL);
throw error;
});
},
/**
* Exceptions thrown in _onRegisterError are caught by the promise obtained
* from _service.request, causing the promise to be rejected instead.
*/
_onRegisterError: function(reply) {
console.debug("_onRegisterError()");
- Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
+
if (!reply.error) {
console.warn("onRegisterError: Called without valid error message!",
reply);
throw new Error("Registration error");
}
throw reply.error;
},
--- a/dom/push/PushServiceHttp2.jsm
+++ b/dom/push/PushServiceHttp2.jsm
@@ -327,17 +327,16 @@ SubscriptionListener.prototype = {
pushReceiptEndpoint: linkParserResult.pushReceiptEndpoint,
scope: this._subInfo.record.scope,
originAttributes: this._subInfo.record.originAttributes,
systemRecord: this._subInfo.record.systemRecord,
appServerKey: this._subInfo.record.appServerKey,
ctime: Date.now(),
});
- Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_HTTP2_TIME").add(Date.now() - this._ctime);
this._resolve(reply);
},
abortRetry: function() {
if (this._retryTimeoutID != null) {
clearTimeout(this._retryTimeoutID);
this._retryTimeoutID = null;
} else {
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -634,17 +634,16 @@ this.PushServiceWebSocket = {
pushEndpoint: reply.pushEndpoint,
scope: tmp.record.scope,
originAttributes: tmp.record.originAttributes,
version: null,
systemRecord: tmp.record.systemRecord,
appServerKey: tmp.record.appServerKey,
ctime: Date.now(),
});
- Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_WS_TIME").add(Date.now() - tmp.ctime);
tmp.resolve(record);
} else {
console.error("handleRegisterReply: Unexpected server response", reply);
tmp.reject(new Error("Wrong status code for register reply: " +
reply.status));
}
},
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -10060,134 +10060,23 @@
"kind": "count",
"description": "Number of content documents destroyed; used in conjunction with use counter histograms"
},
"TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED": {
"expires_in_version": "never",
"kind": "count",
"description": "Number of top-level content documents destroyed; used in conjunction with use counter histograms"
},
- "PUSH_API_USED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "flag",
- "description": "A Push API subscribe() operation was performed at least once this session."
- },
- "PUSH_API_PERMISSION_REQUESTED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Count of number of times the PermissionManager explicitly prompted user for Push Notifications permission"
- },
- "PUSH_API_PERMISSION_DENIED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "User explicitly denied Push Notifications permission"
- },
- "PUSH_API_PERMISSION_GRANTED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "User explicitly granted Push Notifications permission"
- },
- "PUSH_API_SUBSCRIBE_ATTEMPT": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Push Service attempts to subscribe with Push Server."
- },
- "PUSH_API_SUBSCRIBE_FAILED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Attempt to subscribe with Push Server failed."
- },
- "PUSH_API_SUBSCRIBE_SUCCEEDED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Attempt to subscribe with Push Server succeeded."
- },
- "PUSH_API_UNSUBSCRIBE_ATTEMPT": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Push Service attempts to unsubscribe with Push Server."
- },
- "PUSH_API_UNSUBSCRIBE_FAILED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Attempt to unsubscribe with Push Server failed."
- },
- "PUSH_API_UNSUBSCRIBE_SUCCEEDED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Attempt to unsubscribe with Push Server succeeded."
- },
- "PUSH_API_SUBSCRIBE_WS_TIME": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "exponential",
- "high": 15000,
- "n_buckets": 10,
- "description": "Time taken to subscribe over WebSocket (ms)."
- },
- "PUSH_API_SUBSCRIBE_HTTP2_TIME": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "exponential",
- "high": 15000,
- "n_buckets": 10,
- "description": "Time taken to subscribe over HTTP2 (ms)."
- },
- "PUSH_API_QUOTA_EXPIRATION_TIME": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "exponential",
- "high": 31622400,
- "n_buckets": 20,
- "description": "Time taken for a push subscription to expire its quota (seconds). The maximum is just over an year."
- },
- "PUSH_API_QUOTA_RESET_TO": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "exponential",
- "high": 200,
- "n_buckets": 10,
- "description": "The value a push record quota (a count) is reset to based on the user's browsing history."
- },
- "PUSH_API_NOTIFICATION_RECEIVED": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Push notification was received from server."
- },
- "PUSH_API_NOTIFICATION_RECEIVED_BUT_DID_NOT_NOTIFY": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "enumerated",
- "n_values": 16,
- "description": "Push notification was received from server, but not delivered to ServiceWorker. Enumeration values are defined in dom/push/PushService.jsm as kDROP_NOTIFICATION_REASON_*."
- },
"PUSH_API_NOTIFY": {
"releaseChannelCollection": "opt-out",
"alert_emails": ["push@mozilla.com"],
"expires_in_version": "55",
"kind": "count",
"description": "Number of push messages that were successfully decrypted and delivered to a ServiceWorker."
},
- "PUSH_API_NOTIFY_REGISTRATION_LOST": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "kind": "count",
- "description": "Attempt to notify ServiceWorker of push notification resubscription."
- },
"D3D11_SYNC_HANDLE_FAILURE": {
"alert_emails": ["gfx-telemetry-alerts@mozilla.com","bschouten@mozilla.com","danderson@mozilla.com","msreckovic@mozilla.com","ashughes@mozilla.com"],
"expires_in_version": "60",
"releaseChannelCollection": "opt-out",
"kind": "count",
"description": "Number of times the D3D11 compositor failed to get a texture sync handle."
},
"GFX_CONTENT_FAILED_TO_ACQUIRE_DEVICE": {
@@ -10384,23 +10273,16 @@
"PLUGIN_DRAWING_MODEL": {
"alert_emails": ["danderson@mozilla.com"],
"expires_in_version": "never",
"kind": "enumerated",
"bug_numbers": [1229961],
"n_values": 12,
"description": "Plugin drawing model. 0 when windowed, otherwise NPDrawingModel + 1."
},
- "WEB_NOTIFICATION_REQUEST_PERMISSION_CALLBACK": {
- "alert_emails": ["push@mozilla.com"],
- "expires_in_version": "55",
- "bug_numbers": [1241278],
- "kind": "boolean",
- "description": "Usage of the deprecated Notification.requestPermission() callback argument"
- },
"VIDEO_FASTSEEK_USED": {
"alert_emails": ["lchristie@mozilla.com", "cpearce@mozilla.com"],
"expires_in_version": "55",
"bug_numbers": [1245982],
"kind": "count",
"description": "Uses of HTMLMediaElement.fastSeek"
},
"VIDEO_DROPPED_FRAMES_PROPORTION" : {
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -1378,34 +1378,17 @@
"PREDICTOR_TOTAL_PRECONNECTS_CREATED",
"PREDICTOR_TOTAL_PRECONNECTS_UNUSED",
"PREDICTOR_TOTAL_PRECONNECTS_USED",
"PREDICTOR_TOTAL_PREDICTIONS",
"PREDICTOR_TOTAL_PRERESOLVES",
"PREDICTOR_WAIT_TIME",
"PROCESS_CRASH_SUBMIT_ATTEMPT",
"PROCESS_CRASH_SUBMIT_SUCCESS",
- "PUSH_API_NOTIFICATION_RECEIVED",
- "PUSH_API_NOTIFICATION_RECEIVED_BUT_DID_NOT_NOTIFY",
"PUSH_API_NOTIFY",
- "PUSH_API_NOTIFY_REGISTRATION_LOST",
- "PUSH_API_PERMISSION_DENIED",
- "PUSH_API_PERMISSION_GRANTED",
- "PUSH_API_PERMISSION_REQUESTED",
- "PUSH_API_QUOTA_EXPIRATION_TIME",
- "PUSH_API_QUOTA_RESET_TO",
- "PUSH_API_SUBSCRIBE_ATTEMPT",
- "PUSH_API_SUBSCRIBE_FAILED",
- "PUSH_API_SUBSCRIBE_HTTP2_TIME",
- "PUSH_API_SUBSCRIBE_SUCCEEDED",
- "PUSH_API_SUBSCRIBE_WS_TIME",
- "PUSH_API_UNSUBSCRIBE_ATTEMPT",
- "PUSH_API_UNSUBSCRIBE_FAILED",
- "PUSH_API_UNSUBSCRIBE_SUCCEEDED",
- "PUSH_API_USED",
"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_DELETED_ALL",