Bug 1308057 - GetQuery(CURRENT_QUERY) should return null for target mismatch, for targets that share the same slot. - r=ethlin draft
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Mon, 07 Nov 2016 19:37:06 -0800
changeset 437535 fb7eaa78e6efc77e79cbbad783117a369679a3f7
parent 437534 82a0648a3e7296041f4e27db7d981744ea99b032
child 437536 7cea37292bd9fa6903b3f535e9d5c0fce0dc3fa4
push id35436
push userbmo:jgilbert@mozilla.com
push dateFri, 11 Nov 2016 01:52:22 +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))