fix: prevent invalid media processing#44
Conversation
|
Failed pendo.io/jira-ref check. Please correct Jira references in the following commits: |
3 similar comments
|
Failed pendo.io/jira-ref check. Please correct Jira references in the following commits: |
|
Failed pendo.io/jira-ref check. Please correct Jira references in the following commits: |
|
Failed pendo.io/jira-ref check. Please correct Jira references in the following commits: |
There was a problem hiding this comment.
Pull Request Overview
This PR prevents errors during playback by ensuring that non-media elements and blocked media elements do not undergo media processing.
- Returns early from media processing if a media element is flagged as blocked.
- Verifies that media mutations are only applied to supported media elements.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/rrweb/src/replay/media/index.ts | Adds an early exit in addMediaElements when a media element is blocked. |
| packages/rrweb/src/replay/index.ts | Processes media mutations only for supported media elements. |
| .changeset/tiny-rabbits-chew.md | Updates the changeset to reflect the media processing changes. |
| if (!serializedNode || !('attributes' in serializedNode)) return; | ||
|
|
||
| // don't process if the media element is blocked | ||
| const isBlockedMediaElement = serializedNode.attributes.rr_width || serializedNode.attributes.rr_height; |
There was a problem hiding this comment.
Consider verifying the condition explicitly in case rr_width or rr_height are 0, which may be a valid value. Using an explicit comparison (e.g. !== undefined) may prevent unintended early returns.
| const isBlockedMediaElement = serializedNode.attributes.rr_width || serializedNode.attributes.rr_height; | |
| const isBlockedMediaElement = | |
| serializedNode.attributes.rr_width !== undefined || serializedNode.attributes.rr_height !== undefined; |
There was a problem hiding this comment.
not concerned with this since rr_width and rr_height is always a string so it would be "0px" for 0 anyway
4ab5ebf to
2609440
Compare
|
Failed pendo.io/jira-ref check. Please correct Jira references in the following commits: |
4ea09b3 to
c283cbd
Compare
|
Failed pendo.io/jira-ref check. Please correct Jira references in the following commits: |
|
[merge] |
|
Branch jc-prevent-invalid-media-processing deleted |
two main updates to media processing in this PR: