canvas-interceptor
canvas-interceptor copied to clipboard
Support HTMLCanvasElement arguments serialization
Thanks for the PR.
The dependencies thing should not be necessary, because the script should have detected the usage of the canvas elements before. Simply using the getCanvasName(...).canvas should be sufficient (and if you amend the PR to only this change, I will approve it if I don't find other issues during tests. What are you using as a test case?
If the canvas-interceptor ran after the canvases were created, then replaying the dependencies will not help with reconstructing the canvas because not all commands have been found.
Exactly because of these potentially missing instructions (when the script runs too late), I did not initially support HTMLCanvasElement serialization. For methods like drawImage, it would also suffice to serialize the canvas using .toDataURL().