toolkit/modules/UpdateChannel.jsm

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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   }
    47 };

mercurial