Backed out 4 changesets (bug 914481) for xpc and push service test failures

Backed out changeset 6165f6eba17f (bug 914481)
Backed out changeset a8c47e9431d0 (bug 914481)
Backed out changeset f03e8c42861e (bug 914481)
Backed out changeset 84b11173d98f (bug 914481)

--HG--
extra : rebase_source : 9496d5740c290bc6d8169782a8f1a2950711f3d7
This commit is contained in:
Carsten "Tomcat" Book 2015-09-17 12:31:49 +02:00
parent 875a4ba851
commit 6bd408e0ae
6 changed files with 5 additions and 185 deletions

View File

@ -98,20 +98,14 @@ Push.prototype = {
principal: principal,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
allow: function() {
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_GRANTED");
histogram.add();
aAllowCallback();
},
cancel: function() {
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_DENIED");
histogram.add();
aCancelCallback();
},
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)
@ -165,8 +159,6 @@ Push.prototype = {
subscribe: function() {
debug("subscribe()");
let histogram = Services.telemetry.getHistogramById("PUSH_API_USED");
histogram.add(true);
return this.getEndpointResponse(this._client.subscribe.bind(this._client));
},

View File

@ -45,7 +45,6 @@ function PushRecord(props) {
this.pushCount = props.pushCount || 0;
this.lastPush = props.lastPush || 0;
this.setQuota(props.quota);
this.ctime = (typeof props.ctime === "number") ? props.ctime : 0;
}
PushRecord.prototype = {
@ -75,17 +74,11 @@ PushRecord.prototype = {
Math.round(8 * Math.pow(daysElapsed, -0.8)),
prefs.get("maxQuotaPerSubscription")
);
Services.telemetry.getHistogramById("PUSH_API_QUOTA_RESET_TO").add(currentQuota - 1);
} else {
// The user hasn't visited the site since the last notification.
currentQuota = this.quota;
}
this.quota = Math.max(currentQuota - 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);
}
},
receivedPush(lastVisit) {

View File

@ -52,16 +52,6 @@ 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
@ -283,7 +273,7 @@ this.PushService = {
// just for it
if (this._ws) {
debug("Had a connection, so telling the server");
this._sendUnregister({channelID: record.channelID})
this._sendRequest("unregister", {channelID: record.channelID})
.catch(function(e) {
debug("Unregister errored " + e);
});
@ -296,7 +286,7 @@ this.PushService = {
// just for it
if (this._ws) {
debug("Had a connection, so telling the server");
this._sendUnregister({channelID: record.channelID})
this._sendRequest("unregister", {channelID: record.channelID})
.catch(function(e) {
debug("Unregister errored " + e);
});
@ -683,7 +673,6 @@ this.PushService = {
scope: record.scope
};
Services.telemetry.getHistogramById("PUSH_API_NOTIFY_REGISTRATION_LOST").add();
this._notifyListeners('pushsubscriptionchange', data);
},
@ -735,12 +724,6 @@ this.PushService = {
.then(record => this._notifySubscriptionChangeObservers(record));
},
_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,
@ -757,12 +740,10 @@ this.PushService = {
*/
receivedPushMessage: function(keyID, message, updateFunc) {
debug("receivedPushMessage()");
Services.telemetry.getHistogramById("PUSH_API_NOTIFICATION_RECEIVED").add();
let shouldNotify = false;
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();
@ -770,21 +751,15 @@ this.PushService = {
// As a special case, don't notify the service worker if the user
// cleared their history.
shouldNotify = isFinite(lastVisit);
if (!shouldNotify) {
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_HISTORY);
}
return this._db.update(keyID, record => {
let newRecord = updateFunc(record);
if (!newRecord) {
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT);
return null;
}
// FIXME(nsm): WHY IS expired checked here but then also checked in the next case?
if (newRecord.isExpired()) {
// Because `unregister` is advisory only, we can still receive messages
// for stale registrations from the server.
debug("receivedPushMessage: Ignoring update for expired key ID " + keyID);
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_EXPIRED);
return null;
}
newRecord.receivedPush(lastVisit);
@ -803,7 +778,7 @@ this.PushService = {
// 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._sendUnregister(record).catch(error => {
this._sendRequest("unregister", record).catch(error => {
debug("receivedPushMessage: Unregister error: " + error);
});
}
@ -850,7 +825,6 @@ this.PushService = {
scope: aPushRecord.scope
};
Services.telemetry.getHistogramById("PUSH_API_NOTIFY").add();
this._notifyListeners('push', data);
return true;
},
@ -879,7 +853,6 @@ this.PushService = {
_registerWithServer: function(aPageRecord) {
debug("registerWithServer()" + JSON.stringify(aPageRecord));
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_ATTEMPT").add();
return this._sendRequest("register", aPageRecord)
.then(record => this._onRegisterSuccess(record),
err => this._onRegisterError(err))
@ -923,17 +896,6 @@ this.PushService = {
});
},
_sendUnregister: function(aRecord) {
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_ATTEMPT").add();
return this._sendRequest("unregister", aRecord).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);
});
},
/**
* Exceptions thrown in _onRegisterSuccess are caught by the promise obtained
* from _service.request, causing the promise to be rejected instead.
@ -942,13 +904,9 @@ this.PushService = {
debug("_onRegisterSuccess()");
return this._db.put(aRecord)
.then(_ => {
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_SUCCEEDED").add()
})
.catch(error => {
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
// Unable to save. Destroy the subscription in the background.
this._sendUnregister(aRecord).catch(err => {
this._sendRequest("unregister", aRecord).catch(err => {
debug("_onRegisterSuccess: Error unregistering stale subscription" +
err);
});
@ -962,7 +920,6 @@ this.PushService = {
*/
_onRegisterError: function(reply) {
debug("_onRegisterError()");
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
if (!reply.error) {
debug("Called without valid error message!");
throw "Registration error";
@ -1086,7 +1043,7 @@ this.PushService = {
}
return Promise.all([
this._sendUnregister(record),
this._sendRequest("unregister", record),
this._db.delete(record.keyID),
]).then(() => true);
});

View File

@ -260,7 +260,6 @@ var SubscriptionListener = function(aSubInfo, aResolve, aReject,
this._data = '';
this._serverURI = aServerURI;
this._service = aPushServiceHttp2;
this._ctime = Date.now();
};
SubscriptionListener.prototype = {
@ -363,10 +362,8 @@ SubscriptionListener.prototype = {
scope: this._subInfo.record.scope,
originAttributes: this._subInfo.record.originAttributes,
quota: this._subInfo.record.maxQuota,
ctime: Date.now(),
});
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_HTTP2_TIME").add(Date.now() - this._ctime);
this._resolve(reply);
},
};

View File

@ -811,10 +811,8 @@ this.PushServiceWebSocket = {
originAttributes: tmp.record.originAttributes,
version: null,
quota: tmp.record.maxQuota,
ctime: Date.now(),
});
dump("PushWebSocket " + JSON.stringify(record));
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_WS_TIME").add(Date.now() - tmp.ctime);
tmp.resolve(record);
} else {
tmp.reject(reply);

View File

@ -9348,123 +9348,6 @@
"releaseChannelCollection": "opt-out",
"description": "Reason for reporting the Adobe CDM to be unsupported. (1 = NOT_WINDOWS; 2 = WINDOWS_VERSION)"
},
"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": 15,
"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": {
"alert_emails": ["push@mozilla.com"],
"expires_in_version": "55",
"kind": "count",
"description": "Attempt to notify ServiceWorker of push notification."
},
"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."
},
"FXA_CONFIGURED": {
"alert_emails": ["fx-team@mozilla.com"],
"expires_in_version": "45",