Bug 730554 - Part b: Check the result of JS_GetProperty in TexImage2DImageDataOrElement; r=bz

This commit is contained in:
Ms2ger 2012-03-11 09:53:24 +01:00
parent 11fb7b5ca6
commit 9814185b9a
3 changed files with 14 additions and 3 deletions

View File

@ -3,4 +3,5 @@ load 421715-1.html
load 553938-1.html
load 647480.html
load 0px-size-font-667225.html
load texImage2D.html
load 729116.html

View File

@ -0,0 +1,8 @@
<!doctype html>
<canvas></canvas>
<script>
var canvas = document.body.firstChild,
gl = canvas.getContext("experimental-webgl");
gl.texImage2D(0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) });
gl.texSubImage2D(0, 0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) });
</script>

View File

@ -494,9 +494,11 @@ TexImage2DImageDataOrElement(JSContext* cx, T& self, JS::Value* object)
JSObject* imageData = &object->toObject();
jsval js_width, js_height, js_data;
JS_GetProperty(cx, imageData, "width", &js_width);
JS_GetProperty(cx, imageData, "height", &js_height);
JS_GetProperty(cx, imageData, "data", &js_data);
if (!JS_GetProperty(cx, imageData, "width", &js_width) ||
!JS_GetProperty(cx, imageData, "height", &js_height) ||
!JS_GetProperty(cx, imageData, "data", &js_data)) {
return false;
}
if (js_width == JSVAL_VOID ||
js_height == JSVAL_VOID ||
!js_data.isObject())