fix: Validate if WebGLRenderingContext exists before capturing it (#1777)
* Update webgl.ts --------- Co-authored-by: Paul D'Ambra <paul.dambra@gmail.com> Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
42c203d24f
commit
8df3133af5
5
.changeset/healthy-glasses-shout.md
Normal file
5
.changeset/healthy-glasses-shout.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@rrweb/record": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Validate if WebGLRenderingContext exists before capturing it
|
||||||
@@ -95,16 +95,18 @@ export default function initCanvasWebGLMutationObserver(
|
|||||||
): listenerHandler {
|
): listenerHandler {
|
||||||
const handlers: listenerHandler[] = [];
|
const handlers: listenerHandler[] = [];
|
||||||
|
|
||||||
handlers.push(
|
if (typeof win.WebGLRenderingContext !== 'undefined') {
|
||||||
...patchGLPrototype(
|
handlers.push(
|
||||||
win.WebGLRenderingContext.prototype,
|
...patchGLPrototype(
|
||||||
CanvasContext.WebGL,
|
win.WebGLRenderingContext.prototype,
|
||||||
cb,
|
CanvasContext.WebGL,
|
||||||
blockClass,
|
cb,
|
||||||
blockSelector,
|
blockClass,
|
||||||
win,
|
blockSelector,
|
||||||
),
|
win,
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof win.WebGL2RenderingContext !== 'undefined') {
|
if (typeof win.WebGL2RenderingContext !== 'undefined') {
|
||||||
handlers.push(
|
handlers.push(
|
||||||
|
|||||||
Reference in New Issue
Block a user