Bug 1308057 - GetQuery(CURRENT_QUERY) should return null for target mismatch, for targets that share the same slot. - r=ethlin
MozReview-Commit-ID: 27HPXBjBQ6k
--- 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))