toolkit/content/UpdateChannel.jsm
author Sriram Ramasubramanian <sriram@mozilla.com>
Tue, 02 Apr 2013 15:55:09 -0700
changeset 133328 ba4b5ba5492b1679347251a1eb169bc12546842f
parent 121305 31ff0e486fb5e5f72a9173644cd3e8c7148ea31f
permissions -rw-r--r--
Bug 857342 - Don't animate the tab counter if the BrowserToolbar isn't visible. r=mfinkle, a=akeybl

#filter substitution

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

this.EXPORTED_SYMBOLS = ["UpdateChannel"];

const Cu = Components.utils;

Cu.import("resource://gre/modules/Services.jsm");

this.UpdateChannel = {
  /**
   * Read the update channel from defaults only.  We do this to ensure that
   * the channel is tightly coupled with the application and does not apply
   * to other instances of the application that may use the same profile.
   */
  get: function UpdateChannel_get() {
    let channel = "@MOZ_UPDATE_CHANNEL@";
    let defaults = Services.prefs.getDefaultBranch(null);
    try {
      channel = defaults.getCharPref("app.update.channel");
    } catch (e) {
      // use default value when pref not found
    }

    try {
      let partners = Services.prefs.getChildList("app.partner.").sort();
      if (partners.length) {
        channel += "-cck";
        partners.forEach(function (prefName) {
          channel += "-" + Services.prefs.getCharPref(prefName);
        });
      }
    } catch (e) {
      Cu.reportError(e);
    }

    return channel;
  }
};