Bug 1294529 - Wrap .getContext in a try/catch block so that if it throws it doesn't break the rest of about:support, r?jrmuizel
MozReview-Commit-ID: 9OGrjbRdBqr
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -429,31 +429,39 @@ var dataProviders = {
.parseFromString("<html/>", "text/html");
function GetWebGLInfo(contextType) {
let canvas = doc.createElement("canvas");
canvas.width = 1;
canvas.height = 1;
- let creationError = "(no info)";
+ let creationError = null;
canvas.addEventListener(
"webglcontextcreationerror",
function(e) {
creationError = e.statusMessage;
},
false
);
- let gl = canvas.getContext(contextType);
+ let gl = null;
+ try {
+ gl = canvas.getContext(contextType);
+ }
+ catch (e) {
+ if (!creationError) {
+ creationError = e.toString();
+ }
+ }
if (!gl)
- return creationError;
+ return creationError || "(no info)";
let infoExt = gl.getExtension("WEBGL_debug_renderer_info");
// This extension is unconditionally available to chrome. No need to check.
let vendor = gl.getParameter(infoExt.UNMASKED_VENDOR_WEBGL);
let renderer = gl.getParameter(infoExt.UNMASKED_RENDERER_WEBGL);
let contextInfo = vendor + " -- " + renderer;