--- a/toolkit/content/aboutStartup.js
+++ b/toolkit/content/aboutStartup.js
@@ -33,16 +33,18 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var Cc = Components.classes;
var Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/Services.jsm");
+let dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"]
+ .getService(Ci.nsIScriptableDateFormat);
let strings = Services.strings.createBundle("chrome://global/locale/aboutStartup.properties");
let branding = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let brandShortName = branding.GetStringFromName("brandShortName");
function displayTimestamp(id, µs) document.getElementById(id).textContent = formatstamp(µs);
function displayDuration(id, µs) document.getElementById(id).nextSibling.textContent = formatms(msFromµs(µs));
@@ -61,19 +63,24 @@ function formatStr(str, args)
} catch (x) {
return str +" "+ args.toSource();
}
}
function appVersion(version, build) formatStr("appVersion", [brandShortName, version, build]);
function formatExtension(str, name, version) formatStr("extension"+(str.replace(/^on/, "")
.replace(/ing$/, "ed")),
[name, version]);
+function formatDate(date) dateService.FormatDateTime("", dateService.dateFormatLong,
+ dateService.timeFormatSeconds,
+ date.getFullYear(), date.getMonth()+1,
+ date.getDate(), date.getHours(),
+ date.getMinutes(), date.getSeconds());
function msFromµs(µs) µs / 1000;
-function formatstamp(µs) new Date(msFromµs(µs));
+function formatstamp(µs) formatDate(new Date(msFromµs(µs)));
function formatµs(µs) µs + " µs";
function formatms(ms) formatStr("milliseconds", [ms]);
function point(stamp, µs, v, b) [msFromµs(stamp), msFromµs(µs), { appVersion: v, appBuild: b }];
function range(a, b) ({ from: msFromµs(a), to: msFromµs(b || a) });
function mark(x, y) { var r = {}; x && (r.xaxis = x); y && (r.yaxis = y); return r };
function label(r, l) $.extend(r, { label: l });
function color(r, c) $.extend(r, { color: c });
@@ -239,19 +246,20 @@ function populateMeasurements()
handleCompletion: function()
{
var table = $("table");
var height = $(window).height() - (table.offset().top +
table.outerHeight(true))
- 110;
$("#graph").height(Math.max(350, height));
- options.xaxis.min = clamp(Date.now() - 3600000, // 1 hour in milliseconds
- series[0].data[0][0],
- Date.now() - 604800000); // 7 days in milliseconds
+ options.xaxis.min = Date.now() - clamp(3600000, // 1 hour in milliseconds
+ Date.now() - series[0].data[0][0],
+ 604800000); // 7 days in milliseconds
+
var max = 0;
for each (let [stamp, d] in series[0].data)
if (stamp >= options.xaxis.min && d > max)
max = d;
options.yaxis.max = max;
graph = $.plot($("#graph"), series, options);