See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
return renderTask.promise.then(function () {
                    completeRender(false);
                  });
                })
                .catch(function (error) {
                  completeRender("render : " + error);
                });
            },
            function (error) {
              self._snapshot(task, "render : " + error);
            }
          );
        } catch (e) {
          failure = "page setup : " + this._exceptionToString(e);
          this._snapshot(task, failure);
        }
      }
    },
    _clearCanvas: function Driver_clearCanvas() {
      var ctx = this.canvas.getContext("2d", { alpha: false });
      ctx.beginPath();
      ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
    },
    _snapshot: function Driver_snapshot(task, failure) {
      var self = this;
      this._log("Snapshotting... ");
      var dataUrl = this.canvas.toDataURL("image/png");
      this._sendResult(dataUrl, task, failure, function () {
        self._log(
          "done" + (failure ? " (failed !: " + failure + ")" : "") + "\n"