JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec) { if (exec->argumentCount() != 2) return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLShader::s_info)) return throwTypeError(exec); WebGLShader* shader = toWebGLShader(exec->argument(0)); unsigned pname = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context->getShaderParameter(shader, pname, ec); if (ec) { setDOMException(exec, ec); return jsUndefined(); } return toJS(exec, globalObject(), info); }
JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec) { if (exec->argumentCount() != 2) return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec)); ExceptionCode ec = 0; WebGLRenderingContext& context = impl(); if (!exec->uncheckedArgument(0).isUndefinedOrNull() && !exec->uncheckedArgument(0).inherits(JSWebGLShader::info())) return throwTypeError(exec); WebGLShader* shader = toWebGLShader(exec->uncheckedArgument(0)); unsigned pname = exec->uncheckedArgument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context.getShaderParameter(shader, pname, ec); if (ec) { setDOMException(exec, ec); return jsUndefined(); } return toJS(exec, globalObject(), info); }