Backed out changeset 3098f602db56 (bug 1162476) for xpcshell bustage on a CLOSED TREE.
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Wed, 13 May 2015 17:43:42 +0200
changeset 243603 33d19a206cad6996d060dedfc176dbb835595d05
parent 243602 f5d4f0d1fed915fe3f334c60dae4f8ea619b51c0
child 243708 324c3423deafbf1db194df3d6a2accbad2b67c42
push id12919
push usergeorg.fritzsche@googlemail.com
push dateWed, 13 May 2015 15:44:02 +0000
treeherderfx-team@33d19a206cad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1162476
milestone41.0a1
backs out3098f602db56330dd4d5cf46fbed1944046711de
Backed out changeset 3098f602db56 (bug 1162476) for xpcshell bustage on a CLOSED TREE.
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/TelemetryController.jsm
toolkit/components/telemetry/tests/unit/test_PingAPI.js
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -354,16 +354,29 @@
     "description": "Geolocation on OS X is either MLS or CoreLocation"
   },
   "JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT": {
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 10,
     "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1, LegacyGenerator=2, ExpressionClosure=3, LetBlock=4, LetExpression=5, NoSuchMethod=6, FlagsArgument=7, RegExpSourceProp=8"
   },
+  "TELEMETRY_PING": {
+    "expires_in_version": "never",
+    "kind": "exponential",
+    "high": "3000",
+    "n_buckets": 10,
+    "extended_statistics_ok": true,
+    "description": "Time taken to submit telemetry info (ms)"
+  },
+  "TELEMETRY_SUCCESS": {
+    "expires_in_version": "never",
+    "kind": "boolean",
+    "description": "Successful telemetry submission"
+  },
   "XUL_CACHE_DISABLED": {
     "expires_in_version": "default",
     "kind": "flag",
     "description": "XUL cache was disabled"
   },
   "MEMORY_RESIDENT": {
     "alert_emails": ["memshrink-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
@@ -4383,36 +4396,16 @@
   },
   "TELEMETRY_FILES_EVICTED": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com", "rvitillo@mozilla.com"],
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 30,
     "description": "Number of telemetry pings evicted at startup"
   },
-  "TELEMETRY_PING": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "3000",
-    "n_buckets": 10,
-    "extended_statistics_ok": true,
-    "description": "Time taken to submit telemetry info (ms)"
-  },
-  "TELEMETRY_SUCCESS": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Successful telemetry submission"
-  },
-  "TELEMETRY_INVALID_PING_TYPE_SUBMITTED": {
-    "alert_emails": ["telemetry-client-dev@mozilla.com"],
-    "expires_in_version": "never",
-    "kind": "count",
-    "keyed": true,
-    "description": "Count of individual invalid ping types that were submitted to Telemetry."
-  },
   "TELEMETRY_TEST_FLAG": {
     "expires_in_version": "never",
     "kind": "flag",
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_COUNT": {
     "expires_in_version": "never",
     "kind": "count",
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -190,21 +190,16 @@ this.TelemetryController = Object.freeze
   },
 
   /**
    * Submit ping payloads to Telemetry. This will assemble a complete ping, adding
    * environment data, client id and some general info.
    * Depending on configuration, the ping will be sent to the server (immediately or later)
    * and archived locally.
    *
-   * To identify the different pings and to be able to query them pings have a type.
-   * A type is a string identifier that should be unique to the type ping that is being submitted,
-   * it should only contain alphanumeric characters and '-' for separation, i.e. satisfy:
-   * /^[a-z0-9][a-z0-9-]+[a-z0-9]$/i
-   *
    * @param {String} aType The type of the ping.
    * @param {Object} aPayload The actual data payload for the ping.
    * @param {Object} [aOptions] Options object.
    * @param {Boolean} [aOptions.addClientId=false] true if the ping should contain the client
    *                  id, false otherwise.
    * @param {Boolean} [aOptions.addEnvironment=false] true if the ping should contain the
    *                  environment data.
    * @param {Object}  [aOptions.overrideEnvironment=null] set to override the environment data.
@@ -558,25 +553,16 @@ let Impl = {
    *                  environment data.
    * @param {Object}  [aOptions.overrideEnvironment=null] set to override the environment data.
    * @returns {Promise} A promise that is resolved with the ping id once the ping is stored or sent.
    */
   submitExternalPing: function send(aType, aPayload, aOptions) {
     this._log.trace("submitExternalPing - type: " + aType + ", server: " + this._server +
                     ", aOptions: " + JSON.stringify(aOptions));
 
-    // Enforce the type string to only contain sane characters.
-    const typeUuid = /^[a-z0-9][a-z0-9-]+[a-z0-9]$/i;
-    if (!typeUuid.test(aType)) {
-      this._log.error("submitExternalPing - invalid ping type: " + aType);
-      let histogram = Telemetry.getKeyedHistogramById("TELEMETRY_INVALID_PING_TYPE_SUBMITTED");
-      histogram.add(aType, 1);
-      return Promise.reject(new Error("Invalid type string submitted."));
-    }
-
     const pingData = this.assemblePing(aType, aPayload, aOptions);
     this._log.trace("submitExternalPing - ping assembled, id: " + pingData.id);
 
     // Always persist the pings if we are allowed to.
     let archivePromise = TelemetryArchive.promiseArchivePing(pingData)
       .catch(e => this._log.error("submitExternalPing - Failed to archive ping " + pingData.id, e));
     let p = [ archivePromise ];
 
--- a/toolkit/components/telemetry/tests/unit/test_PingAPI.js
+++ b/toolkit/components/telemetry/tests/unit/test_PingAPI.js
@@ -12,17 +12,16 @@ Cu.import("resource://gre/modules/XPCOMU
 Cu.import("resource://gre/modules/osfile.jsm", this);
 Cu.import("resource://gre/modules/Task.jsm", this);
 Cu.import("resource://gre/modules/Services.jsm", this);
 
 XPCOMUtils.defineLazyGetter(this, "gPingsArchivePath", function() {
   return OS.Path.join(OS.Constants.Path.profileDir, "datareporting", "archived");
 });
 
-const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
 
 function run_test() {
   do_get_profile(true);
   run_next_test();
 }
 
 add_task(function* test_archivedPings() {
   // TelemetryController should not be fully initialized at this point.
@@ -161,31 +160,8 @@ add_task(function* test_clientId() {
   let promiseSetup = TelemetryController.reset();
   id = yield TelemetryController.submitExternalPing("test-type", {}, {addClientId: true});
   ping = yield TelemetryArchive.promiseArchivedPingById(id);
   Assert.equal(ping.clientId, clientId);
 
   // Finish setup.
   yield promiseSetup;
 });
-
-add_task(function* test_InvalidPingType() {
-  const TYPES = [
-    "a",
-    "-",
-    "¿€€€?",
-    "-foo-",
-    "-moo",
-    "zoo-",
-    ".bar",
-    "asfd.asdf",
-  ];
-
-  for (let type of TYPES) {
-    let histogram = Telemetry.getKeyedHistogramById("TELEMETRY_INVALID_PING_TYPE_SUBMITTED");
-    Assert.equal(histogram.snapshot(type).sum, 0,
-                 "Should not have counted this invalid ping yet: " + type);
-    Assert.ok(promiseRejects(TelemetryController.submitExternalPing(type, {})),
-              "Ping type should have been rejected.");
-    Assert.equal(histogram.snapshot(type).sum, 1,
-                 "Should have counted this as an invalid ping type.");
-  }
-});