|
1 #filter substitution |
|
2 |
|
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/. */ |
|
6 |
|
7 this.EXPORTED_SYMBOLS = ["UpdateChannel"]; |
|
8 |
|
9 const Cu = Components.utils; |
|
10 |
|
11 Cu.import("resource://gre/modules/Services.jsm"); |
|
12 |
|
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 } |
|
30 |
|
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 } |
|
44 |
|
45 return channel; |
|
46 } |
|
47 }; |