Bug 1109757 - Expose update channel and buildID to about:support data gathering. r=MattN, f=cww, f=gavin, a=sledru
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 28 Jan 2015 01:44:14 +0000
changeset 243624 f402bfa9a35e
parent 243623 ea6cff5fd829
child 243625 c76f32421541
push id4420
push userryanvm@gmail.com
push date2015-02-02 16:43 +0000
treeherdermozilla-beta@e98376bbdf79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, sledru
bugs1109757
milestone36.0
Bug 1109757 - Expose update channel and buildID to about:support data gathering. r=MattN, f=cww, f=gavin, a=sledru
browser/base/content/test/general/browser_remoteTroubleshoot.js
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
--- a/browser/base/content/test/general/browser_remoteTroubleshoot.js
+++ b/browser/base/content/test/general/browser_remoteTroubleshoot.js
@@ -49,16 +49,33 @@ add_task(function*() {
 
   // Try again - now we are expecting a response with the actual data.
   got = yield promiseNewChannelResponse(TEST_URI_GOOD);
 
   // Check some keys we expect to always get.
   Assert.ok(got.message.extensions, "should have extensions");
   Assert.ok(got.message.graphics, "should have graphics");
 
+  // Check we have channel and build ID info:
+  Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID,
+               "should have correct build ID");
+
+  let updateChannel = null;
+  try {
+    updateChannel = Cu.import("resource://gre/modules/UpdateChannel.jsm", {}).UpdateChannel.get();
+  } catch (ex) {}
+  if (!updateChannel) {
+    Assert.ok(!('updateChannel' in got.message.application),
+                "should not have update channel where not available.");
+  } else {
+    Assert.equal(got.message.application.updateChannel, updateChannel,
+                 "should have correct update channel.");
+  }
+
+
   // And check some keys we know we decline to return.
   Assert.ok(!got.message.modifiedPreferences, "should not have a modifiedPreferences key");
   Assert.ok(!got.message.crashes, "should not have crash info");
 
   // Now a http:// URI - should get nothing even with the permission setup.
   got = yield promiseNewChannelResponse(TEST_URI_BAD);
   Assert.ok(got.message === undefined, "should have failed to get any data");
 });
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -126,20 +126,26 @@ this.Troubleshoot = {
 // when done, it must pass its data to the callback.  The resulting snapshot
 // object will contain a name => data entry for each provider.
 let dataProviders = {
 
   application: function application(done) {
     let data = {
       name: Services.appinfo.name,
       version: Services.appinfo.version,
+      buildID: Services.appinfo.appBuildID,
       userAgent: Cc["@mozilla.org/network/protocol;1?name=http"].
                  getService(Ci.nsIHttpProtocolHandler).
                  userAgent,
     };
+
+#ifdef MOZ_UPDATER
+    data.updateChannel = Cu.import("resource://gre/modules/UpdateChannel.jsm", {}).UpdateChannel.get();
+#endif
+
     try {
       data.vendor = Services.prefs.getCharPref("app.support.vendor");
     }
     catch (e) {}
     let urlFormatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
                        getService(Ci.nsIURLFormatter);
     try {
       data.supportURL = urlFormatter.formatURLPref("app.support.baseURL");
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -83,23 +83,30 @@ const SNAPSHOT_SCHEMA = {
         name: {
           required: true,
           type: "string",
         },
         version: {
           required: true,
           type: "string",
         },
+        buildID: {
+          required: true,
+          type: "string",
+        },
         userAgent: {
           required: true,
           type: "string",
         },
         vendor: {
           type: "string",
         },
+        updateChannel: {
+          type: "string",
+        },
         supportURL: {
           type: "string",
         },
         numTotalWindows: {
           type: "number",
         },
         numRemoteWindows: {
           type: "number",