2010-12-16 20:49:54 +00:00
|
|
|
# -*- Mode: js2; indent-tabs-mode: nil; js2-basic-offset: 2; -*-
|
2012-05-21 11:12:37 +00:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2010-02-21 04:42:25 +00:00
|
|
|
|
2012-03-09 23:21:03 +00:00
|
|
|
let Cc = Components.classes;
|
|
|
|
let Ci = Components.interfaces;
|
|
|
|
let Cu = Components.utils;
|
2010-02-21 04:42:25 +00:00
|
|
|
|
2010-09-11 09:16:00 +00:00
|
|
|
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
|
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
2010-02-21 04:42:25 +00:00
|
|
|
|
2010-09-11 09:16:00 +00:00
|
|
|
const ELLIPSIS = Services.prefs.getComplexValue("intl.ellipsis",
|
2010-10-15 09:14:39 +00:00
|
|
|
Ci.nsIPrefLocalizedString).data;
|
2010-02-21 04:42:25 +00:00
|
|
|
|
|
|
|
// We use a preferences whitelist to make sure we only show preferences that
|
|
|
|
// are useful for support and won't compromise the user's privacy. Note that
|
|
|
|
// entries are *prefixes*: for example, "accessibility." applies to all prefs
|
|
|
|
// under the "accessibility.*" branch.
|
|
|
|
const PREFS_WHITELIST = [
|
|
|
|
"accessibility.",
|
2012-01-28 11:56:14 +00:00
|
|
|
"browser.cache.",
|
2011-11-08 01:51:50 +00:00
|
|
|
"browser.display.",
|
2010-02-21 04:42:25 +00:00
|
|
|
"browser.fixup.",
|
|
|
|
"browser.history_expire_",
|
|
|
|
"browser.link.open_newwindow",
|
|
|
|
"browser.places.",
|
2012-06-23 05:38:19 +00:00
|
|
|
"browser.privatebrowsing.",
|
2012-04-09 20:07:59 +00:00
|
|
|
"browser.search.context.loadInBackground",
|
|
|
|
"browser.search.log",
|
|
|
|
"browser.search.openintab",
|
|
|
|
"browser.search.param",
|
|
|
|
"browser.search.searchEnginesURL",
|
|
|
|
"browser.search.suggest.enabled",
|
|
|
|
"browser.search.update",
|
|
|
|
"browser.search.useDBForOrder",
|
2012-02-08 10:56:01 +00:00
|
|
|
"browser.sessionstore.",
|
2010-02-21 04:42:25 +00:00
|
|
|
"browser.startup.homepage",
|
|
|
|
"browser.tabs.",
|
|
|
|
"browser.zoom.",
|
|
|
|
"dom.",
|
|
|
|
"extensions.checkCompatibility",
|
|
|
|
"extensions.lastAppVersion",
|
|
|
|
"font.",
|
2011-11-08 01:51:50 +00:00
|
|
|
"general.autoScroll",
|
2010-02-21 04:42:25 +00:00
|
|
|
"general.useragent.",
|
2010-09-03 18:01:05 +00:00
|
|
|
"gfx.",
|
2011-02-25 16:23:02 +00:00
|
|
|
"html5.",
|
2012-01-28 11:56:14 +00:00
|
|
|
"image.mem.",
|
2010-02-21 04:42:25 +00:00
|
|
|
"javascript.",
|
|
|
|
"keyword.",
|
2012-01-28 11:56:14 +00:00
|
|
|
"layers.",
|
2010-02-21 04:42:25 +00:00
|
|
|
"layout.css.dpi",
|
2012-01-28 11:56:14 +00:00
|
|
|
"media.",
|
2011-11-08 01:51:50 +00:00
|
|
|
"mousewheel.",
|
2010-02-21 04:42:25 +00:00
|
|
|
"network.",
|
2011-11-08 01:51:50 +00:00
|
|
|
"permissions.default.image",
|
2010-02-21 04:42:25 +00:00
|
|
|
"places.",
|
2011-06-30 21:08:11 +00:00
|
|
|
"plugin.",
|
|
|
|
"plugins.",
|
2010-02-21 04:42:25 +00:00
|
|
|
"print.",
|
|
|
|
"privacy.",
|
2011-05-30 07:31:17 +00:00
|
|
|
"security.",
|
2012-01-28 11:56:14 +00:00
|
|
|
"svg.",
|
2011-11-08 05:20:42 +00:00
|
|
|
"toolkit.startup.recent_crashes",
|
2011-05-30 07:31:17 +00:00
|
|
|
"webgl."
|
2010-02-21 04:42:25 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
// The blacklist, unlike the whitelist, is a list of regular expressions.
|
|
|
|
const PREFS_BLACKLIST = [
|
|
|
|
/^network[.]proxy[.]/,
|
|
|
|
/[.]print_to_filename$/,
|
|
|
|
];
|
|
|
|
|
|
|
|
window.onload = function () {
|
|
|
|
// Get the support URL.
|
|
|
|
let urlFormatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
|
|
|
.getService(Ci.nsIURLFormatter);
|
|
|
|
let supportUrl = urlFormatter.formatURLPref("app.support.baseURL");
|
|
|
|
|
|
|
|
// Update the application basics section.
|
2010-09-11 09:16:00 +00:00
|
|
|
document.getElementById("application-box").textContent = Services.appinfo.name;
|
2010-09-02 18:42:04 +00:00
|
|
|
document.getElementById("useragent-box").textContent = navigator.userAgent;
|
2010-02-21 04:42:25 +00:00
|
|
|
document.getElementById("supportLink").href = supportUrl;
|
2010-10-15 09:10:27 +00:00
|
|
|
let version = Services.appinfo.version;
|
|
|
|
try {
|
|
|
|
version += " (" + Services.prefs.getCharPref("app.support.vendor") + ")";
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
document.getElementById("version-box").textContent = version;
|
2010-02-21 04:42:25 +00:00
|
|
|
|
|
|
|
// Update the other sections.
|
2012-02-24 03:34:18 +00:00
|
|
|
populateResetBox();
|
2010-05-01 18:04:44 +00:00
|
|
|
populatePreferencesSection();
|
2010-04-20 22:14:15 +00:00
|
|
|
populateExtensionsSection();
|
2010-08-14 01:29:46 +00:00
|
|
|
populateGraphicsSection();
|
2012-02-17 22:35:20 +00:00
|
|
|
populateJavaScriptSection();
|
2012-06-27 15:47:27 +00:00
|
|
|
populateAccessibilitySection();
|
2012-03-12 23:04:37 +00:00
|
|
|
populateLibVersionsSection();
|
2010-02-21 04:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function populateExtensionsSection() {
|
2010-09-11 09:16:00 +00:00
|
|
|
AddonManager.getAddonsByTypes(["extension"], function(extensions) {
|
2011-04-04 04:32:47 +00:00
|
|
|
extensions.sort(function(a,b) {
|
|
|
|
if (a.isActive != b.isActive)
|
|
|
|
return b.isActive ? 1 : -1;
|
|
|
|
let lc = a.name.localeCompare(b.name);
|
|
|
|
if (lc != 0)
|
|
|
|
return lc;
|
|
|
|
if (a.version != b.version)
|
|
|
|
return a.version > b.version ? 1 : -1;
|
|
|
|
return 0;
|
|
|
|
});
|
2010-04-20 22:14:15 +00:00
|
|
|
let trExtensions = [];
|
2010-09-11 09:16:00 +00:00
|
|
|
for (let i = 0; i < extensions.length; i++) {
|
|
|
|
let extension = extensions[i];
|
2010-04-20 22:14:15 +00:00
|
|
|
let tr = createParentElement("tr", [
|
|
|
|
createElement("td", extension.name),
|
|
|
|
createElement("td", extension.version),
|
2010-09-11 09:16:00 +00:00
|
|
|
createElement("td", extension.isActive),
|
2010-04-20 22:14:15 +00:00
|
|
|
createElement("td", extension.id),
|
|
|
|
]);
|
|
|
|
trExtensions.push(tr);
|
|
|
|
}
|
|
|
|
appendChildren(document.getElementById("extensions-tbody"), trExtensions);
|
|
|
|
});
|
2010-02-21 04:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function populatePreferencesSection() {
|
|
|
|
let modifiedPrefs = getModifiedPrefs();
|
|
|
|
|
|
|
|
function comparePrefs(pref1, pref2) {
|
|
|
|
if (pref1.name < pref2.name)
|
|
|
|
return -1;
|
|
|
|
if (pref1.name > pref2.name)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
let sortedPrefs = modifiedPrefs.sort(comparePrefs);
|
|
|
|
|
|
|
|
let trPrefs = [];
|
|
|
|
sortedPrefs.forEach(function (pref) {
|
|
|
|
let tdName = createElement("td", pref.name, "pref-name");
|
|
|
|
let tdValue = createElement("td", formatPrefValue(pref.value), "pref-value");
|
|
|
|
let tr = createParentElement("tr", [tdName, tdValue]);
|
|
|
|
trPrefs.push(tr);
|
|
|
|
});
|
|
|
|
|
|
|
|
appendChildren(document.getElementById("prefs-tbody"), trPrefs);
|
|
|
|
}
|
|
|
|
|
2012-03-12 23:04:37 +00:00
|
|
|
function populateLibVersionsSection() {
|
|
|
|
function pushInfoRow(table, name, value, value2)
|
|
|
|
{
|
|
|
|
table.push(createParentElement("tr", [
|
|
|
|
createElement("td", name),
|
|
|
|
createElement("td", value),
|
|
|
|
createElement("td", value2),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
|
|
|
|
var v = null;
|
|
|
|
try { // just to be safe
|
|
|
|
v = Cc["@mozilla.org/security/nssversion;1"].getService(Ci.nsINSSVersion);
|
|
|
|
} catch(e) {}
|
|
|
|
if (!v)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let bundle = Services.strings.createBundle("chrome://global/locale/aboutSupport.properties");
|
|
|
|
let libversions_tbody = document.getElementById("libversions-tbody");
|
|
|
|
|
|
|
|
let trLibs = [];
|
|
|
|
trLibs.push(createParentElement("tr", [
|
|
|
|
createElement("th", ""),
|
|
|
|
createElement("th", bundle.GetStringFromName("minLibVersions")),
|
|
|
|
createElement("th", bundle.GetStringFromName("loadedLibVersions")),
|
|
|
|
]));
|
|
|
|
pushInfoRow(trLibs, "NSPR", v.NSPR_MinVersion, v.NSPR_Version);
|
|
|
|
pushInfoRow(trLibs, "NSS", v.NSS_MinVersion, v.NSS_Version);
|
|
|
|
pushInfoRow(trLibs, "NSS Util", v.NSSUTIL_MinVersion, v.NSSUTIL_Version);
|
|
|
|
pushInfoRow(trLibs, "NSS SSL", v.NSSSSL_MinVersion, v.NSSSSL_Version);
|
|
|
|
pushInfoRow(trLibs, "NSS S/MIME", v.NSSSMIME_MinVersion, v.NSSSMIME_Version);
|
|
|
|
|
|
|
|
appendChildren(libversions_tbody, trLibs);
|
|
|
|
}
|
|
|
|
|
2010-08-14 01:29:46 +00:00
|
|
|
function populateGraphicsSection() {
|
2010-08-27 15:49:02 +00:00
|
|
|
function createHeader(name)
|
|
|
|
{
|
|
|
|
let elem = createElement("th", name);
|
|
|
|
elem.className = "column";
|
|
|
|
return elem;
|
|
|
|
}
|
2010-09-11 09:16:00 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
function pushInfoRow(table, name, value)
|
|
|
|
{
|
|
|
|
if(value) {
|
|
|
|
table.push(createParentElement("tr", [
|
|
|
|
createHeader(bundle.GetStringFromName(name)),
|
|
|
|
createElement("td", value),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
}
|
2011-11-18 04:00:37 +00:00
|
|
|
|
|
|
|
function pushLiteralInfoRow(table, name, value)
|
|
|
|
{
|
|
|
|
table.push(createParentElement("tr", [
|
|
|
|
createHeader(name),
|
|
|
|
createElement("td", value),
|
|
|
|
]));
|
|
|
|
}
|
2011-05-03 20:07:17 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
function errorMessageForFeature(feature) {
|
|
|
|
var errorMessage;
|
|
|
|
var status;
|
|
|
|
try {
|
|
|
|
status = gfxInfo.getFeatureStatus(feature);
|
|
|
|
} catch(e) {}
|
|
|
|
switch (status) {
|
|
|
|
case gfxInfo.FEATURE_BLOCKED_DEVICE:
|
|
|
|
case gfxInfo.FEATURE_DISCOURAGED:
|
|
|
|
errorMessage = bundle.GetStringFromName("blockedGfxCard");
|
|
|
|
break;
|
|
|
|
case gfxInfo.FEATURE_BLOCKED_OS_VERSION:
|
|
|
|
errorMessage = bundle.GetStringFromName("blockedOSVersion");
|
|
|
|
break;
|
|
|
|
case gfxInfo.FEATURE_BLOCKED_DRIVER_VERSION:
|
|
|
|
var suggestedDriverVersion;
|
|
|
|
try {
|
|
|
|
suggestedDriverVersion = gfxInfo.getFeatureSuggestedDriverVersion(feature);
|
|
|
|
} catch(e) {}
|
|
|
|
if (suggestedDriverVersion)
|
2011-06-12 15:47:34 +00:00
|
|
|
errorMessage = bundle.formatStringFromName("tryNewerDriver", [suggestedDriverVersion], 1);
|
2011-05-03 20:07:17 +00:00
|
|
|
else
|
|
|
|
errorMessage = bundle.GetStringFromName("blockedDriver");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return errorMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
function pushFeatureInfoRow(table, name, feature, isEnabled, message) {
|
|
|
|
message = message || isEnabled;
|
|
|
|
if (!isEnabled) {
|
|
|
|
var errorMessage = errorMessageForFeature(feature);
|
|
|
|
if (errorMessage)
|
|
|
|
message = errorMessage;
|
|
|
|
}
|
|
|
|
table.push(createParentElement("tr", [
|
|
|
|
createHeader(bundle.GetStringFromName(name)),
|
|
|
|
createElement("td", message),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
function hexValueToString(value)
|
|
|
|
{
|
|
|
|
return value
|
|
|
|
? String('0000' + value.toString(16)).slice(-4)
|
|
|
|
: null;
|
|
|
|
}
|
|
|
|
|
2010-09-11 09:16:00 +00:00
|
|
|
let bundle = Services.strings.createBundle("chrome://global/locale/aboutSupport.properties");
|
2010-09-03 18:01:05 +00:00
|
|
|
let graphics_tbody = document.getElementById("graphics-tbody");
|
|
|
|
|
2010-10-07 18:25:00 +00:00
|
|
|
var gfxInfo = null;
|
2010-08-14 01:29:46 +00:00
|
|
|
try {
|
|
|
|
// nsIGfxInfo is currently only implemented on Windows
|
2010-10-07 18:25:00 +00:00
|
|
|
gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
|
|
|
|
} catch(e) {}
|
|
|
|
|
|
|
|
if (gfxInfo) {
|
2010-08-27 15:49:02 +00:00
|
|
|
let trGraphics = [];
|
2011-05-03 20:07:17 +00:00
|
|
|
pushInfoRow(trGraphics, "adapterDescription", gfxInfo.adapterDescription);
|
2011-12-15 05:03:01 +00:00
|
|
|
pushInfoRow(trGraphics, "adapterVendorID", gfxInfo.adapterVendorID);
|
|
|
|
pushInfoRow(trGraphics, "adapterDeviceID", gfxInfo.adapterDeviceID);
|
2011-05-03 20:07:17 +00:00
|
|
|
pushInfoRow(trGraphics, "adapterRAM", gfxInfo.adapterRAM);
|
|
|
|
pushInfoRow(trGraphics, "adapterDrivers", gfxInfo.adapterDriver);
|
|
|
|
pushInfoRow(trGraphics, "driverVersion", gfxInfo.adapterDriverVersion);
|
|
|
|
pushInfoRow(trGraphics, "driverDate", gfxInfo.adapterDriverDate);
|
2010-10-07 04:40:08 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
#ifdef XP_WIN
|
2011-08-12 13:46:41 +00:00
|
|
|
pushInfoRow(trGraphics, "adapterDescription2", gfxInfo.adapterDescription2);
|
2011-12-15 05:03:01 +00:00
|
|
|
pushInfoRow(trGraphics, "adapterVendorID2", gfxInfo.adapterVendorID2);
|
|
|
|
pushInfoRow(trGraphics, "adapterDeviceID2", gfxInfo.adapterDeviceID2);
|
2011-08-12 13:46:41 +00:00
|
|
|
pushInfoRow(trGraphics, "adapterRAM2", gfxInfo.adapterRAM2);
|
|
|
|
pushInfoRow(trGraphics, "adapterDrivers2", gfxInfo.adapterDriver2);
|
|
|
|
pushInfoRow(trGraphics, "driverVersion2", gfxInfo.adapterDriverVersion2);
|
|
|
|
pushInfoRow(trGraphics, "driverDate2", gfxInfo.adapterDriverDate2);
|
|
|
|
pushInfoRow(trGraphics, "isGPU2Active", gfxInfo.isGPU2Active);
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
var version = Cc["@mozilla.org/system-info;1"]
|
|
|
|
.getService(Ci.nsIPropertyBag2)
|
|
|
|
.getProperty("version");
|
|
|
|
var isWindowsVistaOrHigher = (parseFloat(version) >= 6.0);
|
|
|
|
if (isWindowsVistaOrHigher) {
|
|
|
|
var d2dEnabled = "false";
|
2010-10-07 18:25:00 +00:00
|
|
|
try {
|
2011-05-03 20:07:17 +00:00
|
|
|
d2dEnabled = gfxInfo.D2DEnabled;
|
|
|
|
} catch(e) {}
|
|
|
|
pushFeatureInfoRow(trGraphics, "direct2DEnabled", gfxInfo.FEATURE_DIRECT2D, d2dEnabled);
|
2010-10-07 04:40:08 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
var dwEnabled = "false";
|
|
|
|
try {
|
|
|
|
dwEnabled = gfxInfo.DWriteEnabled + " (" + gfxInfo.DWriteVersion + ")";
|
|
|
|
} catch(e) {}
|
2011-05-11 00:30:20 +00:00
|
|
|
pushInfoRow(trGraphics, "directWriteEnabled", dwEnabled);
|
|
|
|
|
|
|
|
var cleartypeParams = "";
|
|
|
|
try {
|
|
|
|
cleartypeParams = gfxInfo.cleartypeParameters;
|
|
|
|
} catch(e) {
|
|
|
|
cleartypeParams = bundle.GetStringFromName("clearTypeParametersNotFound");
|
|
|
|
}
|
|
|
|
pushInfoRow(trGraphics, "clearTypeParameters", cleartypeParams);
|
2011-05-03 20:07:17 +00:00
|
|
|
}
|
2011-05-11 00:30:20 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
#endif
|
2010-08-27 15:49:02 +00:00
|
|
|
|
2010-12-16 20:49:54 +00:00
|
|
|
var webglrenderer;
|
2011-05-03 20:07:17 +00:00
|
|
|
var webglenabled;
|
2010-12-16 20:49:54 +00:00
|
|
|
try {
|
|
|
|
webglrenderer = gfxInfo.getWebGLParameter("full-renderer");
|
2011-05-03 20:07:17 +00:00
|
|
|
webglenabled = true;
|
2010-12-16 20:49:54 +00:00
|
|
|
} catch (e) {
|
2011-05-03 20:07:17 +00:00
|
|
|
webglrenderer = false;
|
|
|
|
webglenabled = false;
|
2010-12-16 20:49:54 +00:00
|
|
|
}
|
2011-05-03 20:07:17 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
// If ANGLE is not available but OpenGL is, we want to report on the OpenGL feature, because that's what's going to get used.
|
|
|
|
// In all other cases we want to report on the ANGLE feature.
|
|
|
|
var webglfeature = gfxInfo.FEATURE_WEBGL_ANGLE;
|
|
|
|
if (gfxInfo.getFeatureStatus(gfxInfo.FEATURE_WEBGL_ANGLE) != gfxInfo.FEATURE_NO_INFO &&
|
|
|
|
gfxInfo.getFeatureStatus(gfxInfo.FEATURE_WEBGL_OPENGL) == gfxInfo.FEATURE_NO_INFO)
|
|
|
|
webglfeature = gfxInfo.FEATURE_WEBGL_OPENGL;
|
|
|
|
#else
|
|
|
|
var webglfeature = gfxInfo.FEATURE_WEBGL_OPENGL;
|
|
|
|
#endif
|
|
|
|
pushFeatureInfoRow(trGraphics, "webglRenderer", webglfeature, webglenabled, webglrenderer);
|
2010-08-27 15:49:02 +00:00
|
|
|
|
2010-12-16 20:49:54 +00:00
|
|
|
appendChildren(graphics_tbody, trGraphics);
|
2011-11-18 04:00:37 +00:00
|
|
|
|
|
|
|
// display registered graphics properties
|
|
|
|
let graphics_info_properties = document.getElementById("graphics-info-properties");
|
|
|
|
var info = gfxInfo.getInfo();
|
|
|
|
let trGraphicsProperties = [];
|
|
|
|
for (var property in info) {
|
|
|
|
pushLiteralInfoRow(trGraphicsProperties, property, info[property]);
|
|
|
|
}
|
|
|
|
appendChildren(graphics_info_properties, trGraphicsProperties);
|
2011-02-07 21:11:57 +00:00
|
|
|
|
|
|
|
// display any failures that have occurred
|
|
|
|
let graphics_failures_tbody = document.getElementById("graphics-failures-tbody");
|
|
|
|
let trGraphicsFailures = gfxInfo.getFailures().map(function (value)
|
|
|
|
createParentElement("tr", [
|
|
|
|
createElement("td", value)
|
|
|
|
])
|
|
|
|
);
|
|
|
|
appendChildren(graphics_failures_tbody, trGraphicsFailures);
|
|
|
|
|
2011-11-18 04:00:37 +00:00
|
|
|
|
|
|
|
|
2010-10-07 18:25:00 +00:00
|
|
|
} // end if (gfxInfo)
|
2010-08-14 01:29:46 +00:00
|
|
|
|
2010-09-11 09:16:00 +00:00
|
|
|
let windows = Services.ww.getWindowEnumerator();
|
2010-09-03 18:01:05 +00:00
|
|
|
let acceleratedWindows = 0;
|
|
|
|
let totalWindows = 0;
|
|
|
|
let mgrType;
|
|
|
|
while (windows.hasMoreElements()) {
|
|
|
|
totalWindows++;
|
|
|
|
|
|
|
|
let awindow = windows.getNext().QueryInterface(Ci.nsIInterfaceRequestor);
|
|
|
|
let windowutils = awindow.getInterface(Ci.nsIDOMWindowUtils);
|
|
|
|
if (windowutils.layerManagerType != "Basic") {
|
|
|
|
acceleratedWindows++;
|
|
|
|
mgrType = windowutils.layerManagerType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-27 20:14:58 +00:00
|
|
|
let msg = acceleratedWindows;
|
2011-05-03 20:07:17 +00:00
|
|
|
if (acceleratedWindows) {
|
2011-11-27 20:14:58 +00:00
|
|
|
msg += "/" + totalWindows + " " + mgrType;
|
2011-05-03 20:07:17 +00:00
|
|
|
} else {
|
|
|
|
#ifdef XP_WIN
|
|
|
|
var feature = gfxInfo.FEATURE_DIRECT3D_9_LAYERS;
|
|
|
|
#else
|
|
|
|
var feature = gfxInfo.FEATURE_OPENGL_LAYERS;
|
|
|
|
#endif
|
|
|
|
var errMsg = errorMessageForFeature(feature);
|
|
|
|
if (errMsg)
|
|
|
|
msg += ". " + errMsg;
|
|
|
|
}
|
2010-09-03 18:01:05 +00:00
|
|
|
|
2011-01-11 10:58:10 +00:00
|
|
|
appendChildren(graphics_tbody, [
|
|
|
|
createParentElement("tr", [
|
|
|
|
createHeader(bundle.GetStringFromName("acceleratedWindows")),
|
|
|
|
createElement("td", msg),
|
|
|
|
])
|
|
|
|
]);
|
2010-08-14 01:29:46 +00:00
|
|
|
}
|
|
|
|
|
2012-02-17 22:35:20 +00:00
|
|
|
function populateJavaScriptSection() {
|
|
|
|
let enabled = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIDOMWindowUtils)
|
|
|
|
.isIncrementalGCEnabled();
|
|
|
|
document.getElementById("javascript-incremental-gc").textContent = enabled ? "1" : "0";
|
|
|
|
}
|
|
|
|
|
2012-06-27 15:47:27 +00:00
|
|
|
function populateAccessibilitySection() {
|
|
|
|
var active;
|
|
|
|
try {
|
|
|
|
active = Components.manager.QueryInterface(Ci.nsIServiceManager)
|
|
|
|
.isServiceInstantiatedByContractID(
|
|
|
|
"@mozilla.org/accessibilityService;1",
|
|
|
|
Ci.nsISupports);
|
|
|
|
} catch (ex) {
|
|
|
|
active = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById("a11y-activated").textContent = active ? "1" : "0";
|
2012-07-01 05:16:54 +00:00
|
|
|
|
|
|
|
var forceDisabled = 0;
|
|
|
|
forceDisabled = getPrefValue("accessibility.force_disabled").value;
|
|
|
|
|
|
|
|
document.getElementById("a11y-force-disabled").textContent
|
|
|
|
= (forceDisabled == -1) ? "never" :
|
|
|
|
((forceDisabled == 1) ? "1" : "0");
|
2012-06-27 15:47:27 +00:00
|
|
|
}
|
|
|
|
|
2010-09-11 09:16:00 +00:00
|
|
|
function getPrefValue(aName) {
|
|
|
|
let value = "";
|
|
|
|
let type = Services.prefs.getPrefType(aName);
|
|
|
|
switch (type) {
|
2012-01-17 01:18:29 +00:00
|
|
|
case Ci.nsIPrefBranch.PREF_STRING:
|
2010-09-11 09:16:00 +00:00
|
|
|
value = Services.prefs.getComplexValue(aName, Ci.nsISupportsString).data;
|
|
|
|
break;
|
2012-01-17 01:18:29 +00:00
|
|
|
case Ci.nsIPrefBranch.PREF_BOOL:
|
2010-09-11 09:16:00 +00:00
|
|
|
value = Services.prefs.getBoolPref(aName);
|
|
|
|
break;
|
2012-01-17 01:18:29 +00:00
|
|
|
case Ci.nsIPrefBranch.PREF_INT:
|
2010-09-11 09:16:00 +00:00
|
|
|
value = Services.prefs.getIntPref(aName);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return { name: aName, value: value };
|
|
|
|
}
|
2010-08-14 01:29:46 +00:00
|
|
|
|
2010-02-21 04:42:25 +00:00
|
|
|
function formatPrefValue(prefValue) {
|
|
|
|
// Some pref values are really long and don't have spaces. This can cause
|
|
|
|
// problems when copying and pasting into some WYSIWYG editors. In general
|
|
|
|
// the exact contents of really long pref values aren't particularly useful,
|
|
|
|
// so we truncate them to some reasonable length.
|
|
|
|
let maxPrefValueLen = 120;
|
|
|
|
let text = "" + prefValue;
|
|
|
|
if (text.length > maxPrefValueLen)
|
|
|
|
text = text.substring(0, maxPrefValueLen) + ELLIPSIS;
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getModifiedPrefs() {
|
|
|
|
// We use the low-level prefs API to identify prefs that have been
|
|
|
|
// modified, rather that Application.prefs.all since the latter is
|
|
|
|
// much, much slower. Application.prefs.all also gets slower each
|
|
|
|
// time it's called. See bug 517312.
|
|
|
|
let prefNames = getWhitelistedPrefNames();
|
2010-09-11 09:16:00 +00:00
|
|
|
let prefs = [getPrefValue(prefName)
|
2010-02-21 04:42:25 +00:00
|
|
|
for each (prefName in prefNames)
|
2010-09-11 09:16:00 +00:00
|
|
|
if (Services.prefs.prefHasUserValue(prefName)
|
2010-02-21 04:42:25 +00:00
|
|
|
&& !isBlacklisted(prefName))];
|
|
|
|
return prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getWhitelistedPrefNames() {
|
|
|
|
let results = [];
|
|
|
|
PREFS_WHITELIST.forEach(function (prefStem) {
|
2010-09-11 09:16:00 +00:00
|
|
|
let prefNames = Services.prefs.getChildList(prefStem);
|
2010-02-21 04:42:25 +00:00
|
|
|
results = results.concat(prefNames);
|
|
|
|
});
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isBlacklisted(prefName) {
|
|
|
|
return PREFS_BLACKLIST.some(function (re) re.test(prefName));
|
|
|
|
}
|
|
|
|
|
|
|
|
function createParentElement(tagName, childElems) {
|
|
|
|
let elem = document.createElement(tagName);
|
|
|
|
appendChildren(elem, childElems);
|
|
|
|
return elem;
|
|
|
|
}
|
|
|
|
|
2011-06-12 15:47:34 +00:00
|
|
|
function createElement(tagName, textContent, opt_class) {
|
2010-02-21 04:42:25 +00:00
|
|
|
let elem = document.createElement(tagName);
|
2011-06-12 15:47:34 +00:00
|
|
|
elem.textContent = textContent;
|
2010-02-21 04:42:25 +00:00
|
|
|
elem.className = opt_class || "";
|
|
|
|
return elem;
|
|
|
|
}
|
|
|
|
|
|
|
|
function appendChildren(parentElem, childNodes) {
|
|
|
|
for (let i = 0; i < childNodes.length; i++)
|
|
|
|
parentElem.appendChild(childNodes[i]);
|
|
|
|
}
|
|
|
|
|
2012-04-17 02:14:01 +00:00
|
|
|
function getLoadContext() {
|
|
|
|
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIWebNavigation)
|
|
|
|
.QueryInterface(Ci.nsILoadContext);
|
|
|
|
}
|
|
|
|
|
2010-02-21 04:42:25 +00:00
|
|
|
function copyContentsToClipboard() {
|
|
|
|
// Get the HTML and text representations for the important part of the page.
|
|
|
|
let contentsDiv = document.getElementById("contents");
|
|
|
|
let dataHtml = contentsDiv.innerHTML;
|
|
|
|
let dataText = createTextForElement(contentsDiv);
|
|
|
|
|
|
|
|
// We can't use plain strings, we have to use nsSupportsString.
|
|
|
|
let supportsStringClass = Cc["@mozilla.org/supports-string;1"];
|
|
|
|
let ssHtml = supportsStringClass.createInstance(Ci.nsISupportsString);
|
|
|
|
let ssText = supportsStringClass.createInstance(Ci.nsISupportsString);
|
|
|
|
|
|
|
|
let transferable = Cc["@mozilla.org/widget/transferable;1"]
|
|
|
|
.createInstance(Ci.nsITransferable);
|
2012-04-17 02:14:01 +00:00
|
|
|
transferable.init(getLoadContext());
|
2010-02-21 04:42:25 +00:00
|
|
|
|
|
|
|
// Add the HTML flavor.
|
|
|
|
transferable.addDataFlavor("text/html");
|
|
|
|
ssHtml.data = dataHtml;
|
|
|
|
transferable.setTransferData("text/html", ssHtml, dataHtml.length * 2);
|
|
|
|
|
|
|
|
// Add the plain text flavor.
|
|
|
|
transferable.addDataFlavor("text/unicode");
|
|
|
|
ssText.data = dataText;
|
|
|
|
transferable.setTransferData("text/unicode", ssText, dataText.length * 2);
|
|
|
|
|
|
|
|
// Store the data into the clipboard.
|
|
|
|
let clipboard = Cc["@mozilla.org/widget/clipboard;1"]
|
|
|
|
.getService(Ci.nsIClipboard);
|
|
|
|
clipboard.setData(transferable, null, clipboard.kGlobalClipboard);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return the plain text representation of an element. Do a little bit
|
|
|
|
// of pretty-printing to make it human-readable.
|
|
|
|
function createTextForElement(elem) {
|
|
|
|
// Generate the initial text.
|
|
|
|
let textFragmentAccumulator = [];
|
|
|
|
generateTextForElement(elem, "", textFragmentAccumulator);
|
|
|
|
let text = textFragmentAccumulator.join("");
|
|
|
|
|
|
|
|
// Trim extraneous whitespace before newlines, then squash extraneous
|
|
|
|
// blank lines.
|
|
|
|
text = text.replace(/[ \t]+\n/g, "\n");
|
|
|
|
text = text.replace(/\n\n\n+/g, "\n\n");
|
|
|
|
|
|
|
|
// Actual CR/LF pairs are needed for some Windows text editors.
|
|
|
|
#ifdef XP_WIN
|
|
|
|
text = text.replace(/\n/g, "\r\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
function generateTextForElement(elem, indent, textFragmentAccumulator) {
|
|
|
|
// Add a little extra spacing around most elements.
|
|
|
|
if (elem.tagName != "td")
|
|
|
|
textFragmentAccumulator.push("\n");
|
|
|
|
|
|
|
|
// Generate the text representation for each child node.
|
|
|
|
let node = elem.firstChild;
|
|
|
|
while (node) {
|
|
|
|
|
|
|
|
if (node.nodeType == Node.TEXT_NODE) {
|
|
|
|
// Text belonging to this element uses its indentation level.
|
|
|
|
generateTextForTextNode(node, indent, textFragmentAccumulator);
|
|
|
|
}
|
|
|
|
else if (node.nodeType == Node.ELEMENT_NODE) {
|
|
|
|
// Recurse on the child element with an extra level of indentation.
|
|
|
|
generateTextForElement(node, indent + " ", textFragmentAccumulator);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Advance!
|
|
|
|
node = node.nextSibling;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function generateTextForTextNode(node, indent, textFragmentAccumulator) {
|
|
|
|
// If the text node is the first of a run of text nodes, then start
|
|
|
|
// a new line and add the initial indentation.
|
|
|
|
let prevNode = node.previousSibling;
|
|
|
|
if (!prevNode || prevNode.nodeType == Node.TEXT_NODE)
|
|
|
|
textFragmentAccumulator.push("\n" + indent);
|
|
|
|
|
|
|
|
// Trim the text node's text content and add proper indentation after
|
|
|
|
// any internal line breaks.
|
|
|
|
let text = node.textContent.trim().replace("\n", "\n" + indent, "g");
|
|
|
|
textFragmentAccumulator.push(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
function openProfileDirectory() {
|
|
|
|
// Get the profile directory.
|
2010-09-11 09:16:00 +00:00
|
|
|
let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
2010-02-21 04:42:25 +00:00
|
|
|
let profileDir = currProfD.path;
|
|
|
|
|
|
|
|
// Show the profile directory.
|
|
|
|
let nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
|
|
|
|
"nsILocalFile", "initWithPath");
|
|
|
|
new nsLocalFile(profileDir).reveal();
|
|
|
|
}
|
2012-02-24 03:34:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Profile reset is only supported for the default profile if the appropriate migrator exists.
|
|
|
|
*/
|
|
|
|
function populateResetBox() {
|
2012-03-09 23:21:03 +00:00
|
|
|
if (resetSupported())
|
2012-02-24 03:34:18 +00:00
|
|
|
document.getElementById("reset-box").style.visibility = "visible";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Restart the application to reset the profile.
|
|
|
|
*/
|
|
|
|
function resetProfileAndRestart() {
|
|
|
|
let branding = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
|
|
|
let brandShortName = branding.GetStringFromName("brandShortName");
|
|
|
|
|
|
|
|
// Prompt the user to confirm.
|
|
|
|
let retVals = {
|
|
|
|
reset: false,
|
|
|
|
};
|
|
|
|
window.openDialog("chrome://global/content/resetProfile.xul", null,
|
|
|
|
"chrome,modal,centerscreen,titlebar,dialog=yes", retVals);
|
|
|
|
if (!retVals.reset)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Set the reset profile environment variable.
|
|
|
|
let env = Cc["@mozilla.org/process/environment;1"]
|
|
|
|
.getService(Ci.nsIEnvironment);
|
|
|
|
env.set("MOZ_RESET_PROFILE_RESTART", "1");
|
|
|
|
|
|
|
|
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
|
|
|
appStartup.quit(Ci.nsIAppStartup.eForceQuit | Ci.nsIAppStartup.eRestart);
|
|
|
|
}
|