From 88d57500302175c83db191d182f5e04e3682c7b9 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 14 Mar 2019 14:35:09 +0100 Subject: [PATCH] Remove the `src` attribute from `Image` objects used with natively supported JPEG images, when pages are cleaned-up/destroyed This will further help reduce the amount of image data that's currently being held alive, by explicitly removing the `src` attribute. Please note that this is mostly relevant for browsers which do not support `URL.createObjectURL`, or where `disableCreateObjectURL` was manually set by the user, since `blob:` URLs will be revoked (see the previous patch). However, using `about:memory` (in Firefox) it does seem that this may also be generally helpful, given that calling `URL.revokeObjectURL` won't invalidate the image data itself (as far as I can tell). --- src/display/display_utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/display/display_utils.js b/src/display/display_utils.js index 3ad22c345..2d1655681 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -488,6 +488,7 @@ function releaseImageResources(img) { URL.revokeObjectURL) { URL.revokeObjectURL(url); } + img.removeAttribute('src'); } export {