-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Context:
rrweb/packages/rrweb/src/record/observer.ts
Lines 843 to 855 in 94d408f
| const originalPropertyDescriptor = Object.getOwnPropertyDescriptor( | |
| patchTarget?.prototype, | |
| 'adoptedStyleSheets', | |
| ); | |
| if ( | |
| hostId === null || | |
| hostId === -1 || | |
| !patchTarget || | |
| !originalPropertyDescriptor | |
| ) | |
| return () => { | |
| // | |
| }; |
In the lines
const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(
patchTarget?.prototype,
'adoptedStyleSheets',
);
patchTarget is sometimes null. This causes getOwnPropertyDescriptor to throw TypeError: Function.getOwnPropertyDescriptor: Cannot convert undefined or null to object.
I propose null checking before:
const originalPropertyDescriptor = patchTarget?.prototype ? Object.getOwnPropertyDescriptor(
patchTarget.prototype,
'adoptedStyleSheets',
) : null;
if (
hostId === null ||
hostId === -1 ||
!patchTarget ||
!originalPropertyDescriptor
)
return () => {
//
};
Metadata
Metadata
Assignees
Labels
No labels