Bug 1909074. Don't pass OFFSET_BY_ORIGIN to GetResultingTransformMatrix when it's...
[gecko.git] / browser / base / content / aboutDialog.js
blobfc0252ad1bd1c59a6f7c92dbf8a7df59f5998937
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/. */
5 "use strict";
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",
16     this
17   );
20 function init() {
21   let defaults = Services.prefs.getDefaultBranch(null);
22   let distroId = defaults.getCharPref("distribution.id", "");
23   if (distroId) {
24     let distroAbout = defaults.getStringPref("distribution.about", "");
25     // If there is about text, we always show it.
26     if (distroAbout) {
27       let distroField = document.getElementById("distribution");
28       distroField.value = distroAbout;
29       distroField.style.display = "block";
30     }
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", "");
35       if (distroVersion) {
36         distroId += " - " + distroVersion;
37       }
39       let distroIdField = document.getElementById("distributionId");
40       distroIdField.value = distroId;
41       distroIdField.style.display = "block";
42     }
43   }
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,
50   };
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;
63   }
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"
74   );
75   if (relNotesPrefType != Services.prefs.PREF_INVALID) {
76     let relNotesURL = Services.urlFormatter.formatURLPref(
77       "app.releaseNotesURL.aboutDialog"
78     );
79     if (relNotesURL != "about:blank") {
80       relNotesLink.href = relNotesURL;
81       relNotesLink.hidden = false;
82     }
83   }
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 });
92     if (
93       /^release($|\-)/.test(channel) ||
94       Services.sysinfo.getProperty("isPackagedApp")
95     ) {
96       channelLabel.hidden = true;
97     }
98   }
100   if (AppConstants.IS_ESR) {
101     document.getElementById("release").hidden = false;
102   }
105 init();