Skip to content

Commit

Permalink
Ignore noisy webgl params (#1016)
Browse files Browse the repository at this point in the history
* `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 <eoghanmurray@users.noreply.github.com>
  • Loading branch information
eoghanmurray and eoghanmurray authored Oct 8, 2022
1 parent 20ad416 commit 87aa3b6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/rrweb/src/record/observers/canvas/webgl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 87aa3b6

Please sign in to comment.