See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
var completeRender = function (error) {
                
                if (textLayerCanvas) {
                  ctx.save();
                  ctx.globalCompositeOperation = "screen";
                  ctx.fillStyle = "rgb(128, 255, 128)"; 
                  ctx.fillRect(0, 0, viewport.width, viewport.height);
                  ctx.restore();
                  ctx.drawImage(textLayerCanvas, 0, 0);
                }
                
                if (annotationLayerCanvas) {
                  ctx.drawImage(annotationLayerCanvas, 0, 0);
                }
                if (page.stats) {
                  
                  task.stats = page.stats;
                }
                page.cleanup( true);
                self._snapshot(task, error);
              };
              initPromise
                .then(function () {
                  const renderTask = page.render(renderContext);
                  if (task.renderTaskOnContinue) {
                    renderTask.onContinue = function (cont) {
                      
                      setTimeout(cont, RENDER_TASK_ON_CONTINUE_DELAY);
                    };
                  }