Backed out 4 changesets (bug 914481) for xpc and push service test failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 17 Sep 2015 12:31:49 +0200
changeset 297336 b6e914c70e41d8acdd3157582ed8357f9ffdcf22
parent 297335 5c715c7f22c32df4c1425a26d4389ffb761f6a70
child 297337 86bd982df1f9b339dd94d3dac25cbba7d5f20a15
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs914481
milestone43.0a1
backs out6165f6eba17f51cec7e79d83d9bc92ddf9c7162a
a8c47e9431d00712951c8d434a34120fe50322b3
f03e8c42861ea2f6118e89bafb8378f5960ab6b3
84b11173d98f085730896b937b4c826c40007c05
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 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)
dom/push/Push.js
dom/push/PushRecord.jsm
dom/push/PushService.jsm
dom/push/PushServiceHttp2.jsm
dom/push/PushServiceWebSocket.jsm
toolkit/components/telemetry/Histograms.json
--- a/dom/push/Push.js
+++ b/dom/push/Push.js
@@ -93,30 +93,24 @@ Push.prototype = {
     typeArray.appendElement(type, false);
 
     // create a nsIContentPermissionRequest
     let request = {
       types: typeArray,
       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)
                           .getInterface(Ci.nsIDOMWindowUtils);
     windowUtils.askPermission(request);
   },
 
   getEndpointResponse: function(fn) {
@@ -160,18 +154,16 @@ Push.prototype = {
         }
       );
     }.bind(this));
     return p;
   },
 
   subscribe: function() {
     debug("subscribe()");
-    let histogram = Services.telemetry.getHistogramById("PUSH_API_USED");
-    histogram.add(true);
     return this.getEndpointResponse(this._client.subscribe.bind(this._client));
   },
 
   getSubscription: function() {
     debug("getSubscription()" + this._scope);
     return this.getEndpointResponse(this._client.getSubscription.bind(this._client));
   },
 
--- a/dom/push/PushRecord.jsm
+++ b/dom/push/PushRecord.jsm
@@ -40,17 +40,16 @@ const QUOTA_REFRESH_TRANSITIONS_SQL = [
 
 function PushRecord(props) {
   this.pushEndpoint = props.pushEndpoint;
   this.scope = props.scope;
   this.originAttributes = props.originAttributes;
   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 = {
   setQuota(suggestedQuota) {
     this.quota = (!isNaN(suggestedQuota) && suggestedQuota >= 0) ?
                  suggestedQuota : prefs.get("maxQuotaPerSubscription");
   },
 
@@ -70,27 +69,21 @@ PushRecord.prototype = {
     if (lastVisit > this.lastPush) {
       // If the user visited the site since the last time we received a
       // notification, reset the quota.
       let daysElapsed = (Date.now() - lastVisit) / 24 / 60 / 60 / 1000;
       currentQuota = Math.min(
         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) {
     this.updateQuota(lastVisit);
     this.pushCount++;
     this.lastPush = Date.now();
   },
 
--- a/dom/push/PushService.jsm
+++ b/dom/push/PushService.jsm
@@ -47,26 +47,16 @@ const kCHILD_PROCESS_MESSAGES = ["Push:R
 
 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
@@ -278,30 +268,30 @@ this.PushService = {
           .then(records => {
             records.forEach(record => {
               this._db.delete(record.keyID)
                 .then(_ => {
                   // courtesy, but don't establish a connection
                   // 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);
                         });
                   }
                 }, err => {
                   debug("webapps-clear-data: " + record.scope +
                         " Could not delete entry " + record.channelID);
 
                   // courtesy, but don't establish a connection
                   // 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);
                         });
                   }
                   throw "Database error";
                 });
             });
           }, _ => {
@@ -678,17 +668,16 @@ this.PushService = {
       record.scope
     );
 
     let data = {
       originAttributes: record.originAttributes,
       scope: record.scope
     };
 
-    Services.telemetry.getHistogramById("PUSH_API_NOTIFY_REGISTRATION_LOST").add();
     this._notifyListeners('pushsubscriptionchange', data);
   },
 
   _notifyListeners: function(name, data) {
     if (this._childListeners.length > 0) {
       // Try to send messages to all listeners, but remove any that fail since
       // the receiver is likely gone away.
       for (var i = this._childListeners.length - 1; i >= 0; --i) {
@@ -730,66 +719,52 @@ this.PushService = {
       .then(record => this._notifySubscriptionChangeObservers(record));
   },
 
   updateRecordAndNotifyApp: function(aKeyID, aUpdateFunc) {
     return this._db.update(aKeyID, aUpdateFunc)
       .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,
    * the registration and message will be dropped, and the worker will not
    * be notified.
    *
    * @param {String} keyID The push registration ID.
    * @param {String} message The message contents.
    * @param {Function} updateFunc A function that receives the existing
    *  registration record as its argument, and returns a new record. If the
    *  function returns `null` or `undefined`, the record will not be updated.
    *  `PushServiceWebSocket` uses this to drop incoming updates with older
    *  versions.
    */
   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();
     }).then(lastVisit => {
       // 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);
         return newRecord;
       });
     }).then(record => {
       var notified = false;
       if (!record) {
@@ -798,17 +773,17 @@ this.PushService = {
 
       if (shouldNotify) {
         notified = this._notifyApp(record, message);
       }
       if (record.isExpired()) {
         // 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);
         });
       }
       return notified;
     }).catch(error => {
       debug("receivedPushMessage: Error notifying app: " + error);
     });
   },
@@ -845,17 +820,16 @@ this.PushService = {
 
     // TODO data.
     let data = {
       payload: message,
       originAttributes: aPushRecord.originAttributes,
       scope: aPushRecord.scope
     };
 
-    Services.telemetry.getHistogramById("PUSH_API_NOTIFY").add();
     this._notifyListeners('push', data);
     return true;
   },
 
   getByKeyID: function(aKeyID) {
     return this._db.getByKeyID(aKeyID);
   },
 
@@ -874,17 +848,16 @@ this.PushService = {
 
   /**
    * Called on message from the child process. aPageRecord is an object sent by
    * navigator.push, identifying the sending page and other fields.
    */
   _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))
       .then(record => {
         this._deletePendingRequest(aPageRecord);
         return record;
       }, err => {
         this._deletePendingRequest(aPageRecord);
@@ -918,56 +891,40 @@ this.PushService = {
         }
         return record;
       }, error => {
         debug("getByIdentifiers failed");
         throw error;
       });
   },
 
-  _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.
    */
   _onRegisterSuccess: function(aRecord) {
     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);
         });
         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) {
     debug("_onRegisterError()");
-    Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
     if (!reply.error) {
       debug("Called without valid error message!");
       throw "Registration error";
     }
     throw reply.error;
   },
 
   receiveMessage: function(aMessage) {
@@ -1081,17 +1038,17 @@ this.PushService = {
     return this._checkActivated()
       .then(_ => this._db.getByIdentifiers(aPageRecord))
       .then(record => {
         if (record === undefined) {
           return false;
         }
 
         return Promise.all([
-          this._sendUnregister(record),
+          this._sendRequest("unregister", record),
           this._db.delete(record.keyID),
         ]).then(() => true);
       });
   },
 
   unregister: function(aPageRecord, aMessageManager) {
     debug("unregister() " + JSON.stringify(aPageRecord));
 
--- a/dom/push/PushServiceHttp2.jsm
+++ b/dom/push/PushServiceHttp2.jsm
@@ -255,17 +255,16 @@ var SubscriptionListener = function(aSub
                                     aServerURI, aPushServiceHttp2) {
   debug("Creating a new subscription listener.");
   this._subInfo = aSubInfo;
   this._resolve = aResolve;
   this._reject = aReject;
   this._data = '';
   this._serverURI = aServerURI;
   this._service = aPushServiceHttp2;
-  this._ctime = Date.now();
 };
 
 SubscriptionListener.prototype = {
 
   onStartRequest: function(aRequest, aContext) {},
 
   onDataAvailable: function(aRequest, aContext, aStream, aOffset, aCount) {
     debug("subscription listener onDataAvailable()");
@@ -358,20 +357,18 @@ SubscriptionListener.prototype = {
 
     let reply = new PushRecordHttp2({
       subscriptionUri: subscriptionUri,
       pushEndpoint: linkParserResult.pushEndpoint,
       pushReceiptEndpoint: linkParserResult.pushReceiptEndpoint,
       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);
   },
 };
 
 function retryAfterParser(aRequest) {
   var retryAfter = 0;
   try {
     var retryField = aRequest.getResponseHeader("retry-after");
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -806,20 +806,18 @@ this.PushServiceWebSocket = {
 
       let record = new PushRecordWebSocket({
         channelID: reply.channelID,
         pushEndpoint: reply.pushEndpoint,
         scope: tmp.record.scope,
         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);
     }
   },
 
   /**
    * Protocol handler invoked by server message.
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9343,133 +9343,16 @@
   "VIDEO_EME_ADOBE_UNSUPPORTED_REASON": {
     "alert_emails": ["edwin@mozilla.com"],
     "expires_in_version": "50",
     "kind": "enumerated",
     "n_values": 10,
     "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",
     "kind": "flag",
     "releaseChannelCollection": "opt-out",
     "description": "If the user is signed in to a Firefox Account on this device"
   },
   "FXA_UNVERIFIED_ACCOUNT_ERRORS": {