2015-12-02 01:06:02 +03:00
|
|
|
/* 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/. */
|
2004-02-11 03:57:46 +03:00
|
|
|
|
2016-09-07 07:25:35 +03:00
|
|
|
"use strict";
|
|
|
|
|
2015-12-02 01:06:02 +03:00
|
|
|
/* import-globals-from aboutDialog-appUpdater.js */
|
2017-02-22 20:02:59 +03:00
|
|
|
|
2010-09-15 03:17:59 +04:00
|
|
|
// Services = object with smart getters for common XPCOM services
|
2019-01-29 04:27:32 +03:00
|
|
|
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
2019-01-29 06:14:34 +03:00
|
|
|
var { AppConstants } = ChromeUtils.import(
|
|
|
|
"resource://gre/modules/AppConstants.jsm"
|
|
|
|
);
|
2005-06-14 14:21:20 +04:00
|
|
|
|
2018-11-05 19:13:12 +03:00
|
|
|
async function init(aEvent) {
|
2004-02-11 03:57:46 +03:00
|
|
|
if (aEvent.target != document) {
|
|
|
|
return;
|
2019-07-05 10:48:57 +03:00
|
|
|
}
|
2007-09-11 19:52:04 +04:00
|
|
|
|
2017-03-16 21:26:02 +03:00
|
|
|
var distroId = Services.prefs.getCharPref("distribution.id", "");
|
|
|
|
if (distroId) {
|
|
|
|
var distroAbout = Services.prefs.getStringPref("distribution.about", "");
|
2020-06-10 08:31:45 +03:00
|
|
|
// If there is about text, we always show it.
|
2017-03-16 21:26:02 +03:00
|
|
|
if (distroAbout) {
|
|
|
|
var distroField = document.getElementById("distribution");
|
|
|
|
distroField.value = distroAbout;
|
|
|
|
distroField.style.display = "block";
|
2007-09-12 18:16:32 +04:00
|
|
|
}
|
2020-06-10 08:31:45 +03:00
|
|
|
// If it's not a mozilla distribution, show the rest,
|
|
|
|
// unless about text exists, then we always show.
|
|
|
|
if (!distroId.startsWith("mozilla-") || distroAbout) {
|
|
|
|
var distroVersion = Services.prefs.getCharPref(
|
|
|
|
"distribution.version",
|
|
|
|
""
|
|
|
|
);
|
|
|
|
if (distroVersion) {
|
|
|
|
distroId += " - " + distroVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
var distroIdField = document.getElementById("distributionId");
|
|
|
|
distroIdField.value = distroId;
|
|
|
|
distroIdField.style.display = "block";
|
|
|
|
}
|
2007-09-11 19:52:04 +04:00
|
|
|
}
|
|
|
|
|
2011-12-20 04:43:12 +04:00
|
|
|
// Include the build ID and display warning if this is an "a#" (nightly or aurora) build
|
2019-01-18 21:03:18 +03:00
|
|
|
let versionId = "aboutDialog-version";
|
|
|
|
let versionAttributes = {
|
|
|
|
version: AppConstants.MOZ_APP_VERSION_DISPLAY,
|
|
|
|
bits: Services.appinfo.is64Bit ? 64 : 32,
|
|
|
|
};
|
|
|
|
|
2010-10-24 06:57:45 +04:00
|
|
|
let version = Services.appinfo.version;
|
2011-04-14 00:25:58 +04:00
|
|
|
if (/a\d+$/.test(version)) {
|
2019-01-18 21:03:18 +03:00
|
|
|
versionId = "aboutDialog-version-nightly";
|
2010-10-24 06:57:45 +04:00
|
|
|
let buildID = Services.appinfo.appBuildID;
|
2016-09-07 07:25:35 +03:00
|
|
|
let year = buildID.slice(0, 4);
|
|
|
|
let month = buildID.slice(4, 6);
|
|
|
|
let day = buildID.slice(6, 8);
|
2019-01-18 21:03:18 +03:00
|
|
|
versionAttributes.isodate = `${year}-${month}-${day}`;
|
2016-09-07 07:25:35 +03:00
|
|
|
|
2011-12-20 04:43:12 +04:00
|
|
|
document.getElementById("experimental").hidden = false;
|
|
|
|
document.getElementById("communityDesc").hidden = true;
|
2010-10-24 06:57:45 +04:00
|
|
|
}
|
|
|
|
|
2019-01-18 21:03:18 +03:00
|
|
|
// Use Fluent arguments for append version and the architecture of the build
|
|
|
|
let versionField = document.getElementById("version");
|
|
|
|
|
|
|
|
document.l10n.setAttributes(versionField, versionId, versionAttributes);
|
|
|
|
|
|
|
|
await document.l10n.translateElements([versionField]);
|
2016-09-07 07:25:35 +03:00
|
|
|
|
2017-04-11 01:26:23 +03:00
|
|
|
// Show a release notes link if we have a URL.
|
|
|
|
let relNotesLink = document.getElementById("releasenotes");
|
|
|
|
let relNotesPrefType = Services.prefs.getPrefType("app.releaseNotesURL");
|
|
|
|
if (relNotesPrefType != Services.prefs.PREF_INVALID) {
|
|
|
|
let relNotesURL = Services.urlFormatter.formatURLPref(
|
|
|
|
"app.releaseNotesURL"
|
|
|
|
);
|
|
|
|
if (relNotesURL != "about:blank") {
|
|
|
|
relNotesLink.href = relNotesURL;
|
|
|
|
relNotesLink.hidden = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-02 01:06:02 +03:00
|
|
|
if (AppConstants.MOZ_UPDATER) {
|
2017-08-18 11:11:34 +03:00
|
|
|
gAppUpdater = new appUpdater({ buttonAutoFocus: true });
|
2017-06-29 02:03:38 +03:00
|
|
|
|
2015-12-02 01:06:02 +03:00
|
|
|
let channelLabel = document.getElementById("currentChannel");
|
|
|
|
let currentChannelText = document.getElementById("currentChannelText");
|
|
|
|
channelLabel.value = UpdateUtils.UpdateChannel;
|
|
|
|
if (/^release($|\-)/.test(channelLabel.value)) {
|
|
|
|
currentChannelText.hidden = true;
|
2019-07-05 10:48:57 +03:00
|
|
|
}
|
2010-09-24 08:02:08 +04:00
|
|
|
}
|
|
|
|
|
2018-11-20 02:14:05 +03:00
|
|
|
if (AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")) {
|
2018-03-15 01:41:26 +03:00
|
|
|
document.getElementById("release").hidden = false;
|
|
|
|
}
|
2019-05-11 00:02:37 +03:00
|
|
|
|
|
|
|
window.sizeToContent();
|
|
|
|
|
2015-12-02 01:06:02 +03:00
|
|
|
if (AppConstants.platform == "macosx") {
|
|
|
|
window.moveTo(
|
|
|
|
screen.availWidth / 2 - window.outerWidth / 2,
|
|
|
|
screen.availHeight / 5
|
|
|
|
);
|
2010-09-24 08:02:08 +04:00
|
|
|
}
|
2010-09-15 03:17:59 +04:00
|
|
|
}
|