1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* import-globals-from aboutDialog-appUpdater.js */
9 // Services = object with smart getters for common XPCOM services
10 var { AppConstants } = ChromeUtils.importESModule(
11 "resource://gre/modules/AppConstants.sys.mjs"
13 if (AppConstants.MOZ_UPDATER) {
14 Services.scriptloader.loadSubScript(
15 "chrome://browser/content/aboutDialog-appUpdater.js",
21 let defaults = Services.prefs.getDefaultBranch(null);
22 let distroId = defaults.getCharPref("distribution.id", "");
24 let distroAbout = defaults.getStringPref("distribution.about", "");
25 // If there is about text, we always show it.
27 let distroField = document.getElementById("distribution");
28 distroField.value = distroAbout;
29 distroField.style.display = "block";
31 // If it's not a mozilla distribution, show the rest,
32 // unless about text exists, then we always show.
33 if (!distroId.startsWith("mozilla-") || distroAbout) {
34 let distroVersion = defaults.getCharPref("distribution.version", "");
36 distroId += " - " + distroVersion;
39 let distroIdField = document.getElementById("distributionId");
40 distroIdField.value = distroId;
41 distroIdField.style.display = "block";
45 // Include the build ID and display warning if this is an "a#" (nightly or aurora) build
46 let versionId = "aboutDialog-version";
47 let versionAttributes = {
48 version: AppConstants.MOZ_APP_VERSION_DISPLAY,
49 bits: Services.appinfo.is64Bit ? 64 : 32,
52 let version = Services.appinfo.version;
53 if (/a\d+$/.test(version)) {
54 versionId = "aboutDialog-version-nightly";
55 let buildID = Services.appinfo.appBuildID;
56 let year = buildID.slice(0, 4);
57 let month = buildID.slice(4, 6);
58 let day = buildID.slice(6, 8);
59 versionAttributes.isodate = `${year}-${month}-${day}`;
61 document.getElementById("experimental").hidden = false;
62 document.getElementById("communityDesc").hidden = true;
65 // Use Fluent arguments for append version and the architecture of the build
66 let versionField = document.getElementById("version");
68 document.l10n.setAttributes(versionField, versionId, versionAttributes);
70 // Show a release notes link if we have a URL.
71 let relNotesLink = document.getElementById("releasenotes");
72 let relNotesPrefType = Services.prefs.getPrefType(
73 "app.releaseNotesURL.aboutDialog"
75 if (relNotesPrefType != Services.prefs.PREF_INVALID) {
76 let relNotesURL = Services.urlFormatter.formatURLPref(
77 "app.releaseNotesURL.aboutDialog"
79 if (relNotesURL != "about:blank") {
80 relNotesLink.href = relNotesURL;
81 relNotesLink.hidden = false;
85 if (AppConstants.MOZ_UPDATER) {
86 gAppUpdater = new appUpdater({ buttonAutoFocus: true });
88 let channelLabel = document.getElementById("currentChannelText");
89 let channelAttrs = document.l10n.getAttributes(channelLabel);
90 let channel = UpdateUtils.UpdateChannel;
91 document.l10n.setAttributes(channelLabel, channelAttrs.id, { channel });
93 /^release($|\-)/.test(channel) ||
94 Services.sysinfo.getProperty("isPackagedApp")
96 channelLabel.hidden = true;
100 if (AppConstants.IS_ESR) {
101 document.getElementById("release").hidden = false;