-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getExtension
of undefined when instantiating WebglFilterBackend
#5466
Comments
i guess fabric could early exit if this.gl is falsy? |
I looked into the
or even
I am not sure if it impacts other parts of the codebase. |
Actually, just |
i should early exit from all the function that use a glContext since that is not supported in node.
as early as possible |
I am sorry, I just tuned back into this issue. Glad to see you got a PR merged! Thank you! |
I am working on a large scale application where we manually initialize the filter backend as the fabric canvas object is also initialized.
My module interacting with FabricJS is tested with
jest
andjsdom
. In this scenario only, I get an error in fabric's code (this.captureGPUInfo
):More specifically here's where the code block we are interested in:
this.setupGLContext
( and more specificallythis.createWebGLCanvas
) assigns a value tothis.gl
if the canvas element has awebgl
or aexperimental-webgl
context. Without checking if it's truthy,this.captureGPUInfo
then tries to access it. It seems like a jsdom canvas has none of these contexts available and makes the tests break.Here's how I initiate FabricJS: https://jsfiddle.net/YannGuillemot/tq9mz284/
I have been able to get around that by checking if we were running the code in a testing environment. Any suggestions on how to better handle this or would we have to check for node every time?
The text was updated successfully, but these errors were encountered: