From cc4cc8b11b7f346cb272fd21fa0e8fbdaf9ed61d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 29 Jan 2020 11:14:01 +0100 Subject: [PATCH] Remove the, now unused, `releaseImageResources` helper function With the changes in the previous patch, this is now dead code which should thus be removed. --- src/display/api.js | 9 --------- src/display/display_utils.js | 15 --------------- 2 files changed, 24 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index 5d37779c8..ca517edc7 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -43,7 +43,6 @@ import { DOMCMapReaderFactory, loadScript, PageViewport, - releaseImageResources, RenderingCancelledException, StatTimer, } from "./display_utils.js"; @@ -2581,14 +2580,6 @@ class PDFObjects { } clear() { - for (const objId in this._objs) { - const { data } = this._objs[objId]; - - if (typeof Image !== "undefined" && data instanceof Image) { - // Always release the image data when clearing out the cached objects. - releaseImageResources(data); - } - } this._objs = Object.create(null); } } diff --git a/src/display/display_utils.js b/src/display/display_utils.js index 3be6ba021..4578a7d59 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -517,20 +517,6 @@ function deprecated(details) { console.log("Deprecated API usage: " + details); } -function releaseImageResources(img) { - assert(img instanceof Image, "Invalid `img` parameter."); - - const url = img.src; - if ( - typeof url === "string" && - url.startsWith("blob:") && - URL.revokeObjectURL - ) { - URL.revokeObjectURL(url); - } - img.removeAttribute("src"); -} - let pdfDateStringRegex; class PDFDateString { @@ -631,6 +617,5 @@ export { isValidFetchUrl, loadScript, deprecated, - releaseImageResources, PDFDateString, };