Bug 642502 - about:support improvements - r=gavin.sharp

This commit is contained in:
Benoit Jacob 2011-05-03 16:07:17 -04:00
parent 7fb21db053
commit 97d2feb9aa
2 changed files with 95 additions and 54 deletions

View File

@ -176,6 +176,47 @@ function populateGraphicsSection() {
}
}
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)
errorMessage = bundle.formatStringFromName("tryNewerDriver", [suggestedDriverVersion], 1);
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),
]));
}
function hexValueToString(value)
{
return value
@ -202,64 +243,49 @@ function populateGraphicsSection() {
pushInfoRow(trGraphics, "driverVersion", gfxInfo.adapterDriverVersion);
pushInfoRow(trGraphics, "driverDate", gfxInfo.adapterDriverDate);
var d2dEnabled = false;
try {
d2dEnabled = gfxInfo.D2DEnabled;
} catch(e) {}
var d2dMessage = d2dEnabled;
if (!d2dEnabled) {
var d2dStatus = -1; // different from any status value defined in the IDL
#ifdef XP_WIN
var version = Cc["@mozilla.org/system-info;1"]
.getService(Ci.nsIPropertyBag2)
.getProperty("version");
var isWindowsVistaOrHigher = (parseFloat(version) >= 6.0);
if (isWindowsVistaOrHigher) {
var d2dEnabled = "false";
try {
d2dStatus = gfxInfo.getFeatureStatus(gfxInfo.FEATURE_DIRECT2D);
} catch(e) {
window.dump(e + '\n');
}
if (d2dStatus == gfxInfo.FEATURE_BLOCKED_DEVICE ||
d2dStatus == gfxInfo.FEATURE_DISCOURAGED)
{
d2dMessage = bundle.GetStringFromName("blockedGraphicsCard");
}
else if (d2dStatus == gfxInfo.FEATURE_BLOCKED_DRIVER_VERSION)
{
var d2dSuggestedDriverVersion = null;
try {
d2dSuggestedDriverVersion = gfxInfo.getFeatureSuggestedDriverVersion(gfxInfo.FEATURE_DIRECT2D);
} catch(e) {
window.dump(e + '\n');
}
if (d2dSuggestedDriverVersion) {
d2dMessage = bundle.GetStringFromName("tryNewerDriverVersion").replace("%1", d2dSuggestedDriverVersion);
}
}
}
trGraphics.push(createParentElement("tr", [
createHeader(bundle.GetStringFromName("direct2DEnabled")),
createElement("td", d2dMessage),
]));
d2dEnabled = gfxInfo.D2DEnabled;
} catch(e) {}
pushFeatureInfoRow(trGraphics, "direct2DEnabled", gfxInfo.FEATURE_DIRECT2D, d2dEnabled);
var dwEnabled = false;
var dwriteEnabledStr = dwEnabled.toString();
var dwriteVersion;
try {
dwEnabled = gfxInfo.DWriteEnabled;
dwriteVersion = gfxInfo.DWriteVersion;
dwriteEnabledStr = dwEnabled.toString() + " (" + dwriteVersion + ")";
} catch(e) {}
trGraphics.push(createParentElement("tr", [
createHeader(bundle.GetStringFromName("directWriteEnabled")),
createElement("td", dwriteEnabledStr),
]));
var dwEnabled = "false";
try {
dwEnabled = gfxInfo.DWriteEnabled + " (" + gfxInfo.DWriteVersion + ")";
} catch(e) {}
trGraphics.push(createParentElement("tr", [
createHeader(bundle.GetStringFromName("directWriteEnabled")),
createElement("td", dwEnabled),
]));
}
#endif
var webglrenderer;
var webglenabled;
try {
webglrenderer = gfxInfo.getWebGLParameter("full-renderer");
webglenabled = true;
} catch (e) {
webglrenderer = "(WebGL unavailable)";
webglrenderer = false;
webglenabled = false;
}
trGraphics.push(createParentElement("tr", [
createHeader(bundle.GetStringFromName("webglRenderer")),
createElement("td", webglrenderer)
]));
#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);
appendChildren(graphics_tbody, trGraphics);
@ -290,8 +316,18 @@ function populateGraphicsSection() {
}
let msg = acceleratedWindows + "/" + totalWindows;
if (acceleratedWindows)
if (acceleratedWindows) {
msg += " " + mgrType;
} 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;
}
appendChildren(graphics_tbody, [
createParentElement("tr", [

View File

@ -8,11 +8,16 @@
acceleratedWindows = GPU Accelerated Windows
# LOCALIZATION NOTE The verb "blocked" here refers to a graphics feature such as "Direct2D" or "OpenGL layers".
# The %1 here is a placeholder, leave unchanged, it will get replaced by the driver version string.
tryNewerDriverVersion = Blocked on your graphics driver. Try updating your graphics driver to version %1 or newer.
blockedDriver = Blocked for your graphics driver version.
# LOCALIZATION NOTE The %S here is a placeholder, leave unchanged, it will get replaced by the driver version string.
tryNewerDriver = Blocked for your graphics driver version. Try updating your graphics driver to version %S or newer.
# LOCALIZATION NOTE The verb "blocked" here refers to a graphics feature such as "Direct2D" or "OpenGL layers".
blockedGraphicsCard = Blocked on your graphics card because of unresolved driver issues.
blockedGfxCard = Blocked for your graphics card because of unresolved driver issues.
# LOCALIZATION NOTE The verb "blocked" here refers to a graphics feature such as "Direct2D" or "OpenGL layers".
blockedOSVersion = Blocked for your operating system version.
direct2DEnabled = Direct2D Enabled
directWriteEnabled = DirectWrite Enabled