1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #19059 from Snuffleupagus/DOMFilterFactory-rm-_hcmCache

Improve clean-up of `#_hcmCache`-data in `DOMFilterFactory.prototype.destroy`
This commit is contained in:
Tim van der Meij 2024-11-17 16:31:37 +01:00 committed by GitHub
commit fc0484904e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -423,17 +423,18 @@ class DOMFilterFactory extends BaseFilterFactory {
}
destroy(keepHCM = false) {
if (keepHCM && this.#hcmCache.size !== 0) {
if (keepHCM && this.#_hcmCache?.size) {
return;
}
if (this.#_defs) {
this.#_defs.parentNode.parentNode.remove();
this.#_defs = null;
}
if (this.#_cache) {
this.#_cache.clear();
this.#_cache = null;
}
this.#_defs?.parentNode.parentNode.remove();
this.#_defs = null;
this.#_cache?.clear();
this.#_cache = null;
this.#_hcmCache?.clear();
this.#_hcmCache = null;
this.#id = 0;
}