Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #60, #261
This patch implements the canvas mutation observer. It consists of both the record and the replay side changes.
In the record side, we add a
recordCanvas
flag to indicate whether to record canvas elements and the flag defaults to false.Different from our other observers, the canvas observer was disabled by default. Because some applications with heavy canvas usage may emit a lot of data as canvas changed, especially the scenarios that use a lot of
drawImage
API.So the behavior should be audited by users and only record canvas when the flag was set to true.
In the replay side, we add a
UNSAFE_replayCanvas
flag to indicate whether to replay canvas mutations.Similar to the
recordCanvas
flag,UNSAFE_replayCanvas
defaults to false. But unlike the record canvas implementation is stable and safe, the replay canvas implementation is UNSAFE.It's unsafe because we need to add
allow-scripts
to the replay sandbox, which may cause some unexpected script execution. Currently, users should be aware of this implementation detail and enable this feature carefully.