Use WeakSet.prototype.delete() unconditionally in the InternalRenderTask class

It's not necessary to check if an object exists before trying remove it from a `WeakSet`; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet/delete#return_value
This commit is contained in:
Jonas Jenwald 2023-08-28 16:05:11 +02:00
parent 92f7653cfb
commit 9b4efe2c2f

View File

@ -3378,10 +3378,8 @@ class InternalRenderTask {
this.running = false;
this.cancelled = true;
this.gfx?.endDrawing();
InternalRenderTask.#canvasInUse.delete(this._canvas);
if (this._canvas) {
InternalRenderTask.#canvasInUse.delete(this._canvas);
}
this.callback(
error ||
new RenderingCancelledException(
@ -3440,9 +3438,8 @@ class InternalRenderTask {
this.running = false;
if (this.operatorList.lastChunk) {
this.gfx.endDrawing(this.pageColors);
if (this._canvas) {
InternalRenderTask.#canvasInUse.delete(this._canvas);
}
InternalRenderTask.#canvasInUse.delete(this._canvas);
this.callback();
}
}