diff --git a/src/core/worker_stream.js b/src/core/worker_stream.js index f3baa72ea8089..047935316cde4 100644 --- a/src/core/worker_stream.js +++ b/src/core/worker_stream.js @@ -40,9 +40,8 @@ class PDFWorkerStream { } cancelAllRequests(reason) { - if (this._fullRequestReader) { - this._fullRequestReader.cancel(reason); - } + this._fullRequestReader?.cancel(reason); + for (const reader of this._rangeRequestReaders.slice(0)) { reader.cancel(reason); } diff --git a/src/display/api.js b/src/display/api.js index b21e02affc416..d351dcbd110e2 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -3153,11 +3153,7 @@ class PDFObjects { * @returns {Object} */ #ensureObj(objId) { - const obj = this.#objs[objId]; - if (obj) { - return obj; - } - return (this.#objs[objId] = { + return (this.#objs[objId] ||= { capability: new PromiseCapability(), data: null, }); diff --git a/src/pdf.sandbox.js b/src/pdf.sandbox.js index 0fd91a330d265..f7c1d981c3a26 100644 --- a/src/pdf.sandbox.js +++ b/src/pdf.sandbox.js @@ -107,9 +107,7 @@ class Sandbox { } dumpMemoryUse() { - if (this._module) { - this._module.ccall("dumpMemoryUse", null, []); - } + this._module?.ccall("dumpMemoryUse", null, []); } nukeSandbox() {