toolkit/modules/UpdateChannel.jsm

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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