Bug 1308057 - retvals should start null, and missing return. - r=ethlin draft
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Fri, 30 Sep 2016 14:09:12 -0700
changeset 437469 02754e1be4ab50e9f7cf974e32cd11f88893df66
parent 437468 3e93f7c1ee83a5b0396b12525c23a02af7542293
child 437470 4c84c198ddfbf046a89511dbdb60d0acf4bc1a7b
push id35421
push userbmo:jgilbert@mozilla.com
push dateThu, 10 Nov 2016 23:13:55 +0000
reviewersethlin
bugs1308057
milestone52.0a1
Bug 1308057 - retvals should start null, and missing return. - r=ethlin MozReview-Commit-ID: FEOoKQBy7Hk
dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
--- a/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
+++ b/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
@@ -144,16 +144,17 @@ WebGLExtensionDisjointTimerQuery::QueryC
     query->QueueAvailablity();
 }
 
 void
 WebGLExtensionDisjointTimerQuery::GetQueryEXT(JSContext* cx, GLenum target,
                                               GLenum pname,
                                               JS::MutableHandle<JS::Value> retval)
 {
+    retval.setNull();
     if (mIsLost)
         return;
 
     mContext->MakeContextCurrent();
     switch (pname) {
     case LOCAL_GL_CURRENT_QUERY_EXT:
         if (target != LOCAL_GL_TIME_ELAPSED_EXT) {
             mContext->ErrorInvalidEnumInfo("getQueryEXT: Invalid query target.",
@@ -195,25 +196,27 @@ WebGLExtensionDisjointTimerQuery::GetQue
 }
 
 void
 WebGLExtensionDisjointTimerQuery::GetQueryObjectEXT(JSContext* cx,
                                                     WebGLTimerQuery* query,
                                                     GLenum pname,
                                                     JS::MutableHandle<JS::Value> retval)
 {
+    retval.setNull();
     if (mIsLost)
         return;
 
     if (!mContext->ValidateObject("getQueryObjectEXT", query))
         return;
 
     if (query == mActiveQuery.get()) {
         mContext->ErrorInvalidOperation("getQueryObjectEXT: Query must not be"
                                         " active.");
+        return;
     }
 
     mContext->MakeContextCurrent();
     // XXX: Note that the query result *may change* within the same task!
     // This does not follow the specification, which states that all calls
     // checking query results must return the same value until the event loop
     // is empty.
     switch (pname) {