| <title>Drawing to canvas using video with source element does not taint canvas</title> |
| <script src=media-file.js></script> |
| <script src=video-test.js></script> |
| <script src="../resources/js-test-pre.js"></script> |
| function canplaythrough() |
| width = video.videoWidth / 2; |
| height = video.videoHeight / 2; |
| ctx = canvas.getContext("2d"); |
| ctx.drawImage(video, 0, 0, width, height); |
| shouldBeTrue("!!ctx.getImageData(0, 0, width, height)"); |
| description("Test to ensure we don't taint a canvas when drawing from a video the uses source elements rather than the src attribute"); |
| canvas = document.getElementsByTagName('canvas')[0]; |
| waitForEvent('canplaythrough', canplaythrough); |
| var mediaFile = findMediaFile("video", "content/counting"); |
| disableFullTestDetailsPrinting(); |
| runSilently("var source = document.createElement('source'); source.src = '" + mediaFile + "'; video.appendChild(source)"); |
| enableFullTestDetailsPrinting(); |
| <canvas width="160" height="120" ></canvas> |