michael@0: #filter substitution michael@0: michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: this.EXPORTED_SYMBOLS = ["UpdateChannel"]; michael@0: michael@0: const Cu = Components.utils; michael@0: michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: this.UpdateChannel = { michael@0: /** michael@0: * Read the update channel from defaults only. We do this to ensure that michael@0: * the channel is tightly coupled with the application and does not apply michael@0: * to other instances of the application that may use the same profile. michael@0: * michael@0: * @param [optional] aIncludePartners michael@0: * Whether or not to include the partner bits. Default: true. michael@0: */ michael@0: get: function UpdateChannel_get(aIncludePartners = true) { michael@0: let channel = "@MOZ_UPDATE_CHANNEL@"; michael@0: let defaults = Services.prefs.getDefaultBranch(null); michael@0: try { michael@0: channel = defaults.getCharPref("app.update.channel"); michael@0: } catch (e) { michael@0: // use default value when pref not found michael@0: } michael@0: michael@0: if (aIncludePartners) { michael@0: try { michael@0: let partners = Services.prefs.getChildList("app.partner.").sort(); michael@0: if (partners.length) { michael@0: channel += "-cck"; michael@0: partners.forEach(function (prefName) { michael@0: channel += "-" + Services.prefs.getCharPref(prefName); michael@0: }); michael@0: } michael@0: } catch (e) { michael@0: Cu.reportError(e); michael@0: } michael@0: } michael@0: michael@0: return channel; michael@0: } michael@0: };