Bumping gaia.json for 1 gaia revision(s) a=gaia-bump
[gecko.git] / toolkit / modules / UpdateChannel.jsm
blobc2bdce8ad5d065bf89906b9ed4ca2f724975a868
1 #filter substitution
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 this.EXPORTED_SYMBOLS = ["UpdateChannel"];
9 const Cu = Components.utils;
11 Cu.import("resource://gre/modules/Services.jsm");
13 this.UpdateChannel = {
14   /**
15    * Read the update channel from defaults only.  We do this to ensure that
16    * the channel is tightly coupled with the application and does not apply
17    * to other instances of the application that may use the same profile.
18    *
19    * @param [optional] aIncludePartners
20    *        Whether or not to include the partner bits. Default: true.
21    */
22   get: function UpdateChannel_get(aIncludePartners = true) {
23     let channel = "@MOZ_UPDATE_CHANNEL@";
24     let defaults = Services.prefs.getDefaultBranch(null);
25     try {
26       channel = defaults.getCharPref("app.update.channel");
27     } catch (e) {
28       // use default value when pref not found
29     }
31     if (aIncludePartners) {
32       try {
33         let partners = Services.prefs.getChildList("app.partner.").sort();
34         if (partners.length) {
35           channel += "-cck";
36           partners.forEach(function (prefName) {
37             channel += "-" + Services.prefs.getCharPref(prefName);
38           });
39         }
40       } catch (e) {
41         Cu.reportError(e);
42       }
43     }
45     return channel;
46   }