aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2015-12-29 13:55:34 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-01-13 13:41:31 +0100
commit910b2260abcf68f52da674ab30a1577289625629 (patch)
tree089d9d414272b0be53374ab8d2053c94b2b37d78
parent221a58378450d26ff9e3bb645df8fcf5fb43994f (diff)
downloadservo-910b2260abcf68f52da674ab30a1577289625629.tar.gz
servo-910b2260abcf68f52da674ab30a1577289625629.zip
webgl: Check for pending current_program errors
-rw-r--r--components/script/dom/webglrenderingcontext.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 33735d83633..216d6779550 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -696,8 +696,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
constants::LINE_LOOP | constants::LINES |
constants::TRIANGLE_STRIP | constants::TRIANGLE_FAN |
constants::TRIANGLES => {
- // TODO(ecoal95): Check the CURRENT_PROGRAM when we keep track of it, and if it's
- // null generate an InvalidOperation error
+ if self.current_program.get().is_none() {
+ return self.webgl_error(InvalidOperation);
+ }
+
if first < 0 || count < 0 {
self.webgl_error(InvalidValue);
} else {
@@ -733,8 +735,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// TODO ensure a non-null WebGLBuffer must be bound to the ELEMENT_ARRAY_BUFFER
- // TODO(ecoal95): Check the CURRENT_PROGRAM when we keep track of it, and if it's
- // null generate an InvalidOperation error
+ if self.current_program.get().is_none() {
+ return self.webgl_error(InvalidOperation);
+ }
+
match mode {
constants::POINTS | constants::LINE_STRIP |
constants::LINE_LOOP | constants::LINES |