Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
roytam1 2020-12-21 15:13:46 +08:00
commit e075f1b671
21 changed files with 507 additions and 108 deletions

View file

@ -1051,16 +1051,18 @@ function formatNumber(number)
function formatDate(datestr, unknown)
{
// scriptable date formatter, for pretty printing dates
var dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Components.interfaces.nsIScriptableDateFormat);
var date = new Date(datestr);
if (!date.valueOf())
return unknown;
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 dateService.FormatDateTime("", dateService.dateFormatLong,
dateService.timeFormatSeconds,
date.getFullYear(), date.getMonth()+1, date.getDate(),
date.getHours(), date.getMinutes(), date.getSeconds());
}
function doCopy()

View file

@ -185,20 +185,11 @@ FeedWriter.prototype = {
if (!dateObj.getTime())
return false;
return this._dateFormatter.format(dateObj);
},
__dateFormatter: null,
get _dateFormatter() {
if (!this.__dateFormatter) {
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
hour: 'numeric', minute: 'numeric' };
this.__dateFormatter = new Intl.DateTimeFormat(locale, dtOptions);
}
return this.__dateFormatter;
let dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
getService(Ci.nsIScriptableDateFormat);
return dateService.FormatDateTime("", dateService.dateFormatLong, dateService.timeFormatNoSeconds,
dateObj.getFullYear(), dateObj.getMonth()+1, dateObj.getDate(),
dateObj.getHours(), dateObj.getMinutes(), dateObj.getSeconds());
},
/**

View file

@ -409,11 +409,8 @@ var PlacesOrganizer = {
populateRestoreMenu: function() {
let restorePopup = document.getElementById("fileRestorePopup");
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric' };
let dateFormatter = new Intl.DateTimeFormat(locale, dtOptions);
let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"].
getService(Ci.nsIScriptableDateFormat);
// Remove existing menu items. Last item is the restoreFromFile item.
while (restorePopup.childNodes.length > 1)
@ -445,7 +442,13 @@ var PlacesOrganizer = {
let backupDate = PlacesBackups.getDateForFile(backupFiles[i]);
let m = restorePopup.insertBefore(document.createElement("menuitem"),
document.getElementById("restoreFromFile"));
m.setAttribute("label", dateFormatter.format(backupDate) + sizeInfo);
m.setAttribute("label",
dateSvc.FormatDate("",
Ci.nsIScriptableDateFormat.dateFormatLong,
backupDate.getFullYear(),
backupDate.getMonth() + 1,
backupDate.getDate()) +
sizeInfo);
m.setAttribute("value", OS.Path.basename(backupFiles[i]));
m.setAttribute("oncommand",
"PlacesOrganizer.onRestoreMenuItemClick(this);");

View file

@ -33,6 +33,15 @@ PlacesTreeView.prototype = {
return this.__xulStore;
},
__dateService: null,
get _dateService() {
if (!this.__dateService) {
this.__dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
getService(Ci.nsIScriptableDateFormat);
}
return this.__dateService;
},
QueryInterface: XPCOMUtils.generateQI(PTV_interfaces),
// Bug 761494:
@ -495,36 +504,16 @@ PlacesTreeView.prototype = {
let midnight = now - (now % MS_PER_DAY);
midnight += new Date(midnight).getTimezoneOffset() * MS_PER_MINUTE;
let dateFormat = timeMs >= midnight ?
Ci.nsIScriptableDateFormat.dateFormatNone :
Ci.nsIScriptableDateFormat.dateFormatShort;
let timeObj = new Date(timeMs);
return timeMs >= midnight ? this._todayFormatter.format(timeObj)
: this._dateFormatter.format(timeObj);
},
// We use a different formatter for times within the current day,
// so we cache both a "today" formatter and a general date formatter.
__todayFormatter: null,
get _todayFormatter() {
if (!this.__todayFormatter) {
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
const dtOptions = { hour: 'numeric', minute: 'numeric' };
this.__todayFormatter = new Intl.DateTimeFormat(locale, dtOptions);
}
return this.__todayFormatter;
},
__dateFormatter: null,
get _dateFormatter() {
if (!this.__dateFormatter) {
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
const dtOptions = { year: 'numeric', month: 'numeric', day: 'numeric',
hour: 'numeric', minute: 'numeric' };
this.__dateFormatter = new Intl.DateTimeFormat(locale, dtOptions);
}
return this.__dateFormatter;
return (this._dateService.FormatDateTime("", dateFormat,
Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
timeObj.getFullYear(), timeObj.getMonth() + 1,
timeObj.getDate(), timeObj.getHours(),
timeObj.getMinutes(), timeObj.getSeconds()));
},
COLUMN_TYPE_UNKNOWN: 0,

View file

@ -16,6 +16,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
var gCookiesWindow = {
_cm : Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager),
_ds : Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Components.interfaces.nsIScriptableDateFormat),
_hosts : {},
_hostOrder : [],
_tree : null,
@ -514,12 +516,14 @@ var gCookiesWindow = {
formatExpiresString: function (aExpires) {
if (aExpires) {
var date = new Date(1000 * aExpires);
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 this._ds.FormatDateTime("", this._ds.dateFormatLong,
this._ds.timeFormatSeconds,
date.getFullYear(),
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds());
}
return this._bundle.getString("expireAtEndOfSession");
},

View file

@ -5897,7 +5897,12 @@ var OfflineApps = {
var cacheService = Cc["@mozilla.org/network/application-cache-service;1"]
.getService(Ci.nsIApplicationCacheService);
if (!groups) {
groups = cacheService.getGroups();
try {
groups = cacheService.getGroups();
} catch(ex) {
// Cache disabled.
return 0;
}
}
var usage = 0;

View file

@ -283,7 +283,11 @@ var gAdvancedPane = {
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
storage.asyncVisitStorage(visitor, false);
try {
storage.asyncVisitStorage(visitor, false);
} catch(ex) {
// Service unavailable: user most likely crippled the cache.
}
},
updateCacheSizeUI: function(smartSizeEnabled)
@ -393,8 +397,14 @@ var gAdvancedPane = {
{
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
if (!groups)
groups = cacheService.getGroups();
if (!groups) {
try {
groups = cacheService.getGroups();
} catch(ex) {
// Cache disabled.
return 0;
}
}
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
@ -426,27 +436,33 @@ var gAdvancedPane = {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups();
try {
var groups = cacheService.getGroups();
var bundle = document.getElementById("bundlePreferences");
var bundle = document.getElementById("bundlePreferences");
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
}
}
} catch(ex) {
// Cache service unavailable/errored, off-line app cache is disabled or 0
// Do nothing, just leave the box blank.
}
},

View file

@ -105,7 +105,7 @@ exports.menuitems = [
},
key: {
id: "browserToolbox",
modifiers: isMac ? "accel,alt" : "accel,shift",
modifiers: "accel,alt,shift",
keytext: true
}
},

View file

@ -46,6 +46,9 @@
backface-visibility: inherit;
clip: inherit;
/* When the table wrapper is a Flex/Grid item we need these: */
flex-grow: inherit;
flex-shrink: inherit;
flex-basis: inherit;
align-self: inherit;
justify-self: inherit;
grid-column-start: inherit;

View file

@ -108,6 +108,7 @@ int16_t gBadPortList[] = {
42, // name
43, // nicname
53, // domain
69, // TFTP
77, // priv-rjs
79, // finger
87, // ttylink
@ -125,8 +126,10 @@ int16_t gBadPortList[] = {
119, // nntp
123, // NTP
135, // loc-srv / epmap
137, // netbios
139, // netbios
143, // imap2
161, // SNMP
179, // BGP
389, // ldap
465, // smtp+ssl
@ -138,24 +141,32 @@ int16_t gBadPortList[] = {
530, // courier
531, // Chat
532, // netnews
540, // uucp
540, // uucp
554, // rtsp
556, // remotefs
563, // nntp+ssl
587, //
601, //
587, // smtp (outgoing)
601, // syslog-conn
636, // ldap+ssl
993, // imap+ssl
995, // pop3+ssl
1719, // h323 (RAS)
1720, // h323 (hostcall)
1723, // pptp
2049, // nfs
3659, // apple-sasl / PasswordServer
3659, // apple-sasl / PasswordServer
4045, // lockd
5060, // sip
5061, // sips
6000, // x11
6665, // Alternate IRC [Apple addition]
6666, // Alternate IRC [Apple addition]
6667, // Standard IRC [Apple addition]
6668, // Alternate IRC [Apple addition]
6669, // Alternate IRC [Apple addition]
0, // This MUST be zero so that we can populating the array
6566, // SANE
6665, // Alternate IRC [Apple addition]
6666, // Alternate IRC [Apple addition]
6667, // Standard IRC [Apple addition]
6668, // Alternate IRC [Apple addition]
6669, // Alternate IRC [Apple addition]
10080,// Amanda
0, // Sentinel value: This MUST be zero
};
static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown";

View file

@ -107,6 +107,9 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
, mStatus(NS_OK)
, mPriority(PRIORITY_NORMAL)
, mIsCanceling(false)
, mDefaultLoadIsTimed(false)
, mTimedRequests(0)
, mCachedRequests(0)
, mTimedNonCachedRequestsUntilOnEndPageLoad(0)
{
NS_INIT_AGGREGATED(outer);
@ -427,6 +430,12 @@ nsLoadGroup::SetDefaultLoadRequest(nsIRequest *aRequest)
// in particular, nsIChannel::LOAD_DOCUMENT_URI...
//
mLoadFlags &= nsIRequest::LOAD_REQUESTMASK;
nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(aRequest);
mDefaultLoadIsTimed = timedChannel != nullptr;
if (mDefaultLoadIsTimed) {
timedChannel->SetTimingEnabled(true);
}
}
// Else, do not change the group's load flags (see bug 95981)
return NS_OK;
@ -481,6 +490,10 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
if (mPriority != 0)
RescheduleRequest(request, mPriority);
nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(request);
if (timedChannel)
timedChannel->SetTimingEnabled(true);
if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
// Update the count of foreground URIs..
mForegroundCount += 1;

View file

@ -82,6 +82,10 @@ protected:
int32_t mPriority;
bool mIsCanceling;
bool mDefaultLoadIsTimed;
uint32_t mTimedRequests;
uint32_t mCachedRequests;
/* For nsPILoadGroupInternal */
uint32_t mTimedNonCachedRequestsUntilOnEndPageLoad;
};

View file

@ -125,6 +125,7 @@ nsSocketTransportService::nsSocketTransportService()
, mServingPendingQueue(false)
, mMaxTimePerPollIter(100)
, mMaxTimeForPrClosePref(PR_SecondsToInterval(5))
, mSleepPhase(false)
, mProbedMaxCount(false)
#if defined(XP_WIN)
, mPolling(false)
@ -566,6 +567,8 @@ nsSocketTransportService::Init()
if (obsSvc) {
obsSvc->AddObserver(this, "profile-initial-state", false);
obsSvc->AddObserver(this, "last-pb-context-exited", false);
obsSvc->AddObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC, true);
obsSvc->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true);
obsSvc->AddObserver(this, "xpcom-shutdown-threads", false);
}
@ -632,9 +635,16 @@ nsSocketTransportService::ShutdownThread()
if (obsSvc) {
obsSvc->RemoveObserver(this, "profile-initial-state");
obsSvc->RemoveObserver(this, "last-pb-context-exited");
obsSvc->RemoveObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC);
obsSvc->RemoveObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC);
obsSvc->RemoveObserver(this, "xpcom-shutdown-threads");
}
if (mAfterWakeUpTimer) {
mAfterWakeUpTimer->Cancel();
mAfterWakeUpTimer = nullptr;
}
NetworkActivityMonitor::Shutdown();
mInitialized = false;
@ -1237,6 +1247,10 @@ nsSocketTransportService::Observe(nsISupports *subject,
if (!strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) {
nsCOMPtr<nsITimer> timer = do_QueryInterface(subject);
if (timer == mAfterWakeUpTimer) {
mAfterWakeUpTimer = nullptr;
mSleepPhase = false;
}
#if defined(XP_WIN)
if (timer == mPollRepairTimer) {
@ -1244,6 +1258,19 @@ nsSocketTransportService::Observe(nsISupports *subject,
}
#endif
} else if (!strcmp(topic, NS_WIDGET_SLEEP_OBSERVER_TOPIC)) {
mSleepPhase = true;
if (mAfterWakeUpTimer) {
mAfterWakeUpTimer->Cancel();
mAfterWakeUpTimer = nullptr;
}
} else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) {
if (mSleepPhase && !mAfterWakeUpTimer) {
mAfterWakeUpTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mAfterWakeUpTimer) {
mAfterWakeUpTimer->Init(this, 2000, nsITimer::TYPE_ONE_SHOT);
}
}
} else if (!strcmp(topic, "xpcom-shutdown-threads")) {
ShutdownThread();
}

View file

@ -258,6 +258,9 @@ private:
Atomic<int32_t, Relaxed> mMaxTimePerPollIter;
Atomic<PRIntervalTime, Relaxed> mMaxTimeForPrClosePref;
Atomic<bool, Relaxed> mSleepPhase;
nsCOMPtr<nsITimer> mAfterWakeUpTimer;
void OnKeepaliveEnabledPrefChange();
void NotifyKeepaliveEnabledPrefChange(SocketContext *sock);

View file

@ -0,0 +1,3 @@
[table-item-flex-percentage-width.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1674268

View file

@ -0,0 +1,140 @@
<!doctype html>
<title>Reference: display:table flex items with flex-shrink/flex-grow/flex-basis</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1673006">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
html,body {
color:black; background-color:white; font:20px/1 Ahem; padding:0; margin:0;
}
.container {
display: flex;
width: 180px;
border: 1px solid blue;
}
.container > * {
background-color: cyan;
display: block;
}
.test1 > * {
flex-shrink: 0;
width: 100%;
}
.test2 > * {
flex-shrink: 0;
width: 50%;
}
.test3 > * {
flex-shrink: 0.5;
width: 50%;
}
.test4 > * {
flex-grow: 0.1;
width: 50%;
}
.test5 > * {
flex-shrink: 0.2;
flex-grow: 0.5;
width: 10%;
}
.base > * {
flex-basis: 100px;
}
.large-base {
width: 100px;
}
.large-base > * {
flex-basis: 200px;
}
</style>
<div class="container test1">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test2">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test3">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test4">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test5">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test1 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test2 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test3 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test4 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test5 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test1 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test2 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test3 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test4 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test5 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>

View file

@ -0,0 +1,144 @@
<!doctype html>
<title>Flexbox Test: display:table flex items with flex-shrink/flex-grow/flex-basis</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1673006">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-property">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1673006">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1454330">
<link rel="match" href="table-item-flex-percentage-width-ref.html">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
html,body {
color:black; background-color:white; font:20px/1 Ahem; padding:0; margin:0;
}
.container {
display: flex;
width: 180px;
border: 1px solid blue;
}
.container > * {
background-color: cyan;
display: table;
}
.test1 > * {
flex-shrink: 0;
width: 100%;
}
.test2 > * {
flex-shrink: 0;
width: 50%;
}
.test3 > * {
flex-shrink: 0.5;
width: 50%;
}
.test4 > * {
flex-grow: 0.1;
width: 50%;
}
.test5 > * {
flex-shrink: 0.2;
flex-grow: 0.5;
width: 10%;
}
.base > * {
flex-basis: 100px;
}
.large-base {
width: 100px;
}
.large-base > * {
flex-basis: 200px;
}
</style>
<div class="container test1">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test2">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test3">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test4">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test5">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test1 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test2 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test3 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test4 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test5 base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test1 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test2 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test3 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test4 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="container test5 large-base">
<div>1</div>
<div>2</div>
<div>3</div>
</div>

View file

@ -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");
}

View file

@ -717,6 +717,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) {

View file

@ -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

View file

@ -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());
}
};