mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-11-01 03:57:30 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
e075f1b671
21 changed files with 507 additions and 108 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);");
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue