From 87aa3b6a3d4368d8a3e3cf9f25cb07420bdd05b5 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Sat, 8 Oct 2022 03:28:01 +0100 Subject: [PATCH] Ignore noisy webgl params (#1016) * `isContextLost` is particularly noisy, being called almost constantly by e.g. Figma to check whether there's a need to re initialize a canvas Juice10: We could perhaps look at https://github.com/microsoft/TypeScript/blob/5cd49f6cbcd2effe9d425dee3a39cb49209bb656/lib/lib.dom.d.ts#L14578 via https://stackoverflow.com/questions/60150251/how-to-import-an-interface-from-lib-dom-d-ts * Apply formatting changes Co-authored-by: eoghanmurray --- packages/rrweb/src/record/observers/canvas/webgl.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/rrweb/src/record/observers/canvas/webgl.ts b/packages/rrweb/src/record/observers/canvas/webgl.ts index f3397d76..9e8bfbf4 100644 --- a/packages/rrweb/src/record/observers/canvas/webgl.ts +++ b/packages/rrweb/src/record/observers/canvas/webgl.ts @@ -24,6 +24,18 @@ function patchGLPrototype( const props = Object.getOwnPropertyNames(prototype); for (const prop of props) { + if ( + //prop.startsWith('get') || // e.g. getProgramParameter, but too risky + [ + 'isContextLost', + 'canvas', + 'drawingBufferWidth', + 'drawingBufferHeight', + ].includes(prop) + ) { + // skip read only propery/functions + continue; + } try { if (typeof prototype[prop as keyof typeof prototype] !== 'function') { continue;