Bug 645792 - Replace throwing an exception by returning null on HTMLCanvasElement::GetContext. r=bjacob

CLOSED TREE
This commit is contained in:
Guillaume Abadie 2013-08-29 10:14:22 -04:00
parent 8f4379b006
commit c981a4bb3a
4 changed files with 7 additions and 9 deletions

View File

@ -66,9 +66,8 @@
MochiKit.DOM.addLoadEvent(function () {
var canvas = document.getElementById("canvas");
try {
gl = canvas.getContext("experimental-webgl");
} catch (e) {
gl = canvas.getContext("experimental-webgl");
if (!gl) {
todo(false, "Canvas WebGL not supported");
SimpleTest.finish();
return;

View File

@ -804,6 +804,7 @@ HTMLCanvasElement::GetContext(JSContext* aCx,
rv = UpdateContext(aCx, aContextOptions);
if (rv.Failed()) {
rv = NS_OK; // See bug 645792
return nullptr;
}
mCurrentContextId.Assign(aContextId);

View File

@ -16,9 +16,8 @@
function testInt64NonFinite(arg) {
// We can use a WebGLRenderingContext to test conversion to 64-bit signed
// ints edge cases.
try {
var gl = $("c").getContext("experimental-webgl");
} catch (ex) {
var gl = $("c").getContext("experimental-webgl");
if (!gl) {
// No WebGL support on MacOS 10.5. Just skip this test
todo(false, "WebGL not supported");
return;

View File

@ -20,9 +20,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=775852
/** Test for Bug 775852 **/
function doTest() {
try {
var gl = $("c").getContext("experimental-webgl");
} catch (e) {
var gl = $("c").getContext("experimental-webgl");
if (!gl) {
// No WebGL support on MacOS 10.5. Just skip this test
todo(false, "WebGL not supported");
return;