diff --git a/src/display/api.js b/src/display/api.js index dfbd57f79..005d1ec5a 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1026,13 +1026,6 @@ class PDFDocumentProxy { return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa); } - /** - * Destroys the current document instance and terminates the worker. - */ - destroy() { - return this.loadingTask.destroy(); - } - /** * @param {RefProxy} ref - The page reference. * @returns {number | null} The page number, if it's cached. diff --git a/test/driver.js b/test/driver.js index 8533c7b40..7e098f7e0 100644 --- a/test/driver.js +++ b/test/driver.js @@ -969,7 +969,7 @@ class Driver { // Wipe out the link to the pdfdoc so it can be GC'ed. for (const task of [this.currentTask, ...this.taskQueue]) { if (task?.pdfDoc) { - destroyedPromises.push(task.pdfDoc.destroy()); + destroyedPromises.push(task.pdfDoc.loadingTask.destroy()); delete task.pdfDoc; } } diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index 7245ffa0c..27ee9007b 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -3203,7 +3203,7 @@ describe("api", function () { params.url = url.href; loadingTask = getDocument(params); return loadingTask.promise - .then(pdf => pdf.destroy()) + .then(() => loadingTask.destroy()) .then( function () { expect(expectSuccess).toEqual(true); diff --git a/web/internal/debugger.js b/web/internal/debugger.js index 7b7f4d786..6330fd492 100644 --- a/web/internal/debugger.js +++ b/web/internal/debugger.js @@ -95,7 +95,7 @@ async function openDocument(source, name) { if (pdfDoc) { pageView.reset(); - await pdfDoc.destroy(); + await pdfDoc.loadingTask.destroy(); pdfDoc = null; }