Bug 1290032 - return null for InvalidEnum. r=jgilbert
authorJerryShih <hshih@mozilla.com>
Thu, 28 Jul 2016 17:37:00 +0200
changeset 332332 85b1e566b5b8c665604bd6a866f916ed2f532948
parent 332331 22b93575a3d939787576df00ac185a8e1ece3e17
child 332333 a9d6defe44163d7375df62109877519dc658f845
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1290032
milestone50.0a1
Bug 1290032 - return null for InvalidEnum. r=jgilbert
dom/canvas/WebGL2ContextSamplers.cpp
--- a/dom/canvas/WebGL2ContextSamplers.cpp
+++ b/dom/canvas/WebGL2ContextSamplers.cpp
@@ -198,27 +198,27 @@ WebGL2Context::SamplerParameterfv(WebGLS
 
     sampler->SamplerParameter1f(pname, param[0]);
     WebGLContextUnchecked::SamplerParameterfv(sampler, pname, param.Elements());
 }
 
 void
 WebGL2Context::GetSamplerParameter(JSContext*, WebGLSampler* sampler, GLenum pname, JS::MutableHandleValue retval)
 {
+    retval.setNull();
+
     if (IsContextLost())
         return;
 
     if (!sampler || sampler->IsDeleted())
         return ErrorInvalidOperation("getSamplerParameter: invalid sampler");
 
     if (!ValidateSamplerParameterName(pname, "getSamplerParameter"))
         return;
 
-    retval.set(JS::NullValue());
-
     switch (pname) {
     case LOCAL_GL_TEXTURE_MIN_FILTER:
     case LOCAL_GL_TEXTURE_MAG_FILTER:
     case LOCAL_GL_TEXTURE_WRAP_S:
     case LOCAL_GL_TEXTURE_WRAP_T:
     case LOCAL_GL_TEXTURE_WRAP_R:
     case LOCAL_GL_TEXTURE_COMPARE_MODE:
     case LOCAL_GL_TEXTURE_COMPARE_FUNC: