Bug 1308057 - GetQuery(CURRENT_QUERY) should return null for target mismatch, for targets that share the same slot. - r=ethlin
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Mon, 07 Nov 2016 19:37:06 -0800
changeset 438668 f4437f996855db0b4a53d5123b03a74f01a1a18f
parent 438667 562012ee3497c66c55b718cf0b27bb47bce5c556
child 438669 16ab7b5f3a0876362e47ed0db5aa3f3d87eaa298
push id35794
push usersledru@mozilla.com
push dateMon, 14 Nov 2016 22:18:09 +0000
reviewersethlin
bugs1308057
milestone52.0a1
Bug 1308057 - GetQuery(CURRENT_QUERY) should return null for target mismatch, for targets that share the same slot. - r=ethlin MozReview-Commit-ID: 27HPXBjBQ6k
dom/canvas/WebGL2ContextQueries.cpp
--- a/dom/canvas/WebGL2ContextQueries.cpp
+++ b/dom/canvas/WebGL2ContextQueries.cpp
@@ -186,16 +186,20 @@ WebGLContext::GetQuery(JSContext* cx, GL
                 // INVALID_ENUM.
                 return;
             }
 
             const auto& slot = ValidateQuerySlotByTarget(funcName, target);
             if (!slot || !*slot)
                 return;
 
+            const auto& query = *slot;
+            if (target != query->Target())
+                return;
+
             JS::Rooted<JS::Value> v(cx);
             dom::GetOrCreateDOMReflector(cx, slot->get(), &v);
             retval.set(v);
         }
         return;
 
     case LOCAL_GL_QUERY_COUNTER_BITS_EXT:
         if (!IsExtensionEnabled(WebGLExtensionID::EXT_disjoint_timer_query))