summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-12-15 15:09:30 +0000
committerMoonchild <moonchild@palemoon.org>2020-12-15 15:09:30 +0000
commitdabdec3b3ae9cd920e9fe75622a10ce290552941 (patch)
tree4d462fe7a5f314369f373f6a42214bc9c0efbfcb /toolkit
parent5165ed02285315cc0bed7977c7bac6d0a90ca43c (diff)
parentcd17592001225e2d988c3aca9bd700de3c8ce4a3 (diff)
downloadUXP-dabdec3b3ae9cd920e9fe75622a10ce290552941.tar
UXP-dabdec3b3ae9cd920e9fe75622a10ce290552941.tar.gz
UXP-dabdec3b3ae9cd920e9fe75622a10ce290552941.tar.lz
UXP-dabdec3b3ae9cd920e9fe75622a10ce290552941.tar.xz
UXP-dabdec3b3ae9cd920e9fe75622a10ce290552941.zip
Merge branch 'redwood' into releaseRC_20201215
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/cookie/content/cookieAcceptDialog.js30
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm16
-rw-r--r--toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.properties2
-rw-r--r--toolkit/mozapps/update/content/history.js17
4 files changed, 53 insertions, 12 deletions
diff --git a/toolkit/components/cookie/content/cookieAcceptDialog.js b/toolkit/components/cookie/content/cookieAcceptDialog.js
index 4b322e95d..5f5760305 100644
--- a/toolkit/components/cookie/content/cookieAcceptDialog.js
+++ b/toolkit/components/cookie/content/cookieAcceptDialog.js
@@ -13,6 +13,7 @@ Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var params;
var cookieBundle;
+var gDateService = null;
var showDetails = "";
var hideDetails = "";
@@ -38,6 +39,14 @@ function onload()
document.getElementById("cancel").setAttribute("icon", "cancel");
document.getElementById("disclosureButton").setAttribute("icon", "properties");
+ // Initialize the date formatter
+ if (!gDateService) {
+ const nsScriptableDateFormat_CONTRACTID = "@mozilla.org/intl/scriptabledateformat;1";
+ const nsIScriptableDateFormat = Components.interfaces.nsIScriptableDateFormat;
+ gDateService = Components.classes[nsScriptableDateFormat_CONTRACTID]
+ .getService(nsIScriptableDateFormat);
+ }
+
cookieBundle = document.getElementById("cookieBundle");
// cache strings
@@ -174,12 +183,21 @@ function cookieDeny()
function GetExpiresString(secondsUntilExpires) {
if (secondsUntilExpires) {
var date = new Date(1000*secondsUntilExpires);
- const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIXULChromeRegistry)
- .getSelectedLocale("global", true);
- const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: 'numeric', second: 'numeric' };
- return date.toLocaleString(locale, dtOptions);
+
+ // if a server manages to set a really long-lived cookie, the dateservice
+ // can't cope with it properly, so we'll return a descriptive string instead.
+ var expiry = "";
+ try {
+ expiry = gDateService.FormatDateTime("", gDateService.dateFormatLong,
+ gDateService.timeFormatSeconds,
+ date.getFullYear(), date.getMonth()+1,
+ date.getDate(), date.getHours(),
+ date.getMinutes(), date.getSeconds());
+ } catch (ex) {
+ // Expiry duration was out of range for the date formatter, meaning a silly long time.
+ expiry = cookieBundle.getString("expireInAVeryLongTime");
+ }
+ return expiry;
}
return cookieBundle.getString("expireAtEndOfSession");
}
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
index 7656128d2..ce525d4aa 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -718,6 +718,22 @@ this.DownloadIntegration = {
return;
}
+#ifdef XP_WIN
+ // When a file has no extension, and there's an executable file with the
+ // same name in the same folder, the Windows shell can get confused.
+ // For this reason, we show the file in the containing folder instead of
+ // trying to open it.
+ // We also don't trust mimeinfo; it could be a type we can forward to a
+ // system handler, but it could also be an executable type, and we
+ // don't have an exhaustive list with all of them.
+ if (!fileExtension) {
+ // We can't check for the existence of a same-name file with every
+ // possible executable extension, so this is a catch-all.
+ this.showContainingDirectory(aDownload.target.path);
+ return;
+ }
+#endif
+
// No custom application chosen, let's launch the file with the default
// handler. First, let's try to launch it through the MIME service.
if (mimeInfo) {
diff --git a/toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.properties b/toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.properties
index bba121498..698c6f010 100644
--- a/toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.properties
+++ b/toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.properties
@@ -7,6 +7,8 @@ domainColon=Domain:
forSecureOnly=Encrypted connections only
forAnyConnection=Any type of connection
expireAtEndOfSession=At end of session
+# LOCALIZATION NOTE (expireInAVeryLongTime) This string is used if a cookie won't expire for a literal life age and then some.
+expireInAVeryLongTime=Not in your lifetime
showDetails=Show Details
hideDetails=Hide Details
diff --git a/toolkit/mozapps/update/content/history.js b/toolkit/mozapps/update/content/history.js
index c5bbccefc..809eee478 100644
--- a/toolkit/mozapps/update/content/history.js
+++ b/toolkit/mozapps/update/content/history.js
@@ -58,13 +58,18 @@ var gUpdateHistory = {
* @returns A human readable date string
*/
_formatDate: function(seconds) {
+ var sdf =
+ Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
+ getService(Components.interfaces.nsIScriptableDateFormat);
var date = new Date(seconds);
- const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIXULChromeRegistry)
- .getSelectedLocale("global", true);
- const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: 'numeric', second: 'numeric' };
- return date.toLocaleString(locale, dtOptions);
+ return sdf.FormatDateTime("", sdf.dateFormatLong,
+ sdf.timeFormatSeconds,
+ date.getFullYear(),
+ date.getMonth() + 1,
+ date.getDate(),
+ date.getHours(),
+ date.getMinutes(),
+ date.getSeconds());
}
};