LibWeb/WebGL: Set INVALID_OPERATION if object does not belong to context

This commit is contained in:
Aliaksandr Kalenik 2024-12-17 16:17:37 +01:00 committed by Alexander Kalenik
parent fbae24f7a9
commit 07635d4554
Notes: github-actions[bot] 2024-12-19 12:39:36 +00:00
3 changed files with 79 additions and 20 deletions

View file

@ -10,6 +10,8 @@
#include <LibWeb/Bindings/WebGLObjectPrototype.h>
#include <LibWeb/WebGL/WebGLObject.h>
#include <GLES2/gl2.h>
namespace Web::WebGL {
WebGLObject::WebGLObject(JS::Realm& realm, WebGLRenderingContextBase& context, GLuint handle)
@ -33,4 +35,11 @@ void WebGLObject::visit_edges(Visitor& visitor)
visitor.visit(m_context->gc_cell());
}
ErrorOr<GLuint> WebGLObject::handle(WebGLRenderingContextBase const* context) const
{
if (context == m_context)
return m_handle;
return Error::from_errno(GL_INVALID_OPERATION);
}
}