Don't bother. It's hard to do it correctly. If you look through the snippets (or the MDN docs[1]), the value is retrieved using the getParameter() function. You might be tempted to override the function by doing something like
gl.getParameter = () => "test"
but that's easily detectable. If you run
gl.getParameter.toString()
You get back
"() => "test""
whereas the original function you get back
"function getParameter() { [native code] }"
In general, don't try to fix fingerprinting via content scripts[2]. It's very much detectable. Your best bet is a browser that handles it natively.
You can easily hide it by hijacking Function.prototype.toString to see if `this == fake gl.getParemeter or this == fake toString`. Then the js code needs to find a real Function.prototype.toString by creating an iframe, but then you can detect that. Then I'm out of ideas on how to rescue the original toString
So the issue is that the fingerprinting code can detect the anti-fingerprinting code? Doesn't that mean the best solution is for everyone to override the same functions with the same dummy information?
[1] https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug...
[2] https://palant.info/2020/12/10/how-anti-fingerprinting-exten...