mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-05 06:47:31 +09:00
Add UpdateChannel.jsm
This commit is contained in:
parent
fdcf4c1482
commit
a12132838a
2 changed files with 50 additions and 0 deletions
47
toolkit/modules/UpdateChannel.jsm
Normal file
47
toolkit/modules/UpdateChannel.jsm
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
#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.
|
||||||
|
*
|
||||||
|
* @param [optional] aIncludePartners
|
||||||
|
* Whether or not to include the partner bits. Default: true.
|
||||||
|
*/
|
||||||
|
get: function UpdateChannel_get(aIncludePartners = true) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aIncludePartners) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -104,6 +104,9 @@ EXTRA_JS_MODULES += [
|
||||||
EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
|
EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
|
||||||
EXTRA_JS_MODULES.sessionstore += ['sessionstore/Utils.jsm']
|
EXTRA_JS_MODULES.sessionstore += ['sessionstore/Utils.jsm']
|
||||||
|
|
||||||
|
if not CONFIG['MOZ_WEBEXTENSIONS']:
|
||||||
|
EXTRA_JS_PP_MODULES += ['UpdateChannel.jsm']
|
||||||
|
|
||||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
|
||||||
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
|
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue