diff --git a/dom/canvas/test/captureStream_common.js b/dom/canvas/test/captureStream_common.js index 3d0be3602356..778f34d60d05 100644 --- a/dom/canvas/test/captureStream_common.js +++ b/dom/canvas/test/captureStream_common.js @@ -42,8 +42,9 @@ CaptureStreamTestHelper.prototype = { startDrawing: function (f) { var stop = false; var draw = () => { + if (stop) { return; } f(); - if (!stop) { window.requestAnimationFrame(draw); } + window.requestAnimationFrame(draw); }; draw(); return { stop: () => stop = true };