Merge pull request #9935 from Snuffleupagus/builtInCMapCache-cleanup-regression
[Regression] Convert `Catalog.builtInCMapCache` into a `Map`, instead of an Object, to ensure that it's correctly reset (PR 8064 follow-up)
This commit is contained in:
		
						commit
						39846a6de3
					
				@ -132,16 +132,15 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
				
			|||||||
    this.pdfFunctionFactory = pdfFunctionFactory;
 | 
					    this.pdfFunctionFactory = pdfFunctionFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.fetchBuiltInCMap = (name) => {
 | 
					    this.fetchBuiltInCMap = (name) => {
 | 
				
			||||||
      var cachedCMap = this.builtInCMapCache[name];
 | 
					      if (this.builtInCMapCache.has(name)) {
 | 
				
			||||||
      if (cachedCMap) {
 | 
					        return Promise.resolve(this.builtInCMapCache.get(name));
 | 
				
			||||||
        return Promise.resolve(cachedCMap);
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return this.handler.sendWithPromise('FetchBuiltInCMap', {
 | 
					      return this.handler.sendWithPromise('FetchBuiltInCMap', {
 | 
				
			||||||
        name,
 | 
					        name,
 | 
				
			||||||
      }).then((data) => {
 | 
					      }).then((data) => {
 | 
				
			||||||
        if (data.compressionType !== CMapCompressionType.NONE) {
 | 
					        if (data.compressionType !== CMapCompressionType.NONE) {
 | 
				
			||||||
          // Given the size of uncompressed CMaps, only cache compressed ones.
 | 
					          // Given the size of uncompressed CMaps, only cache compressed ones.
 | 
				
			||||||
          this.builtInCMapCache[name] = data;
 | 
					          this.builtInCMapCache.set(name, data);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return data;
 | 
					        return data;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,7 @@ var Catalog = (function CatalogClosure() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.fontCache = new RefSetCache();
 | 
					    this.fontCache = new RefSetCache();
 | 
				
			||||||
    this.builtInCMapCache = Object.create(null);
 | 
					    this.builtInCMapCache = new Map();
 | 
				
			||||||
    this.pageKidsCountCache = new RefSetCache();
 | 
					    this.pageKidsCountCache = new RefSetCache();
 | 
				
			||||||
    // TODO refactor to move getPage() to the PDFDocument.
 | 
					    // TODO refactor to move getPage() to the PDFDocument.
 | 
				
			||||||
    this.pageFactory = pageFactory;
 | 
					    this.pageFactory = pageFactory;
 | 
				
			||||||
@ -449,7 +449,7 @@ var Catalog = (function CatalogClosure() {
 | 
				
			|||||||
          delete font.translated;
 | 
					          delete font.translated;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.fontCache.clear();
 | 
					        this.fontCache.clear();
 | 
				
			||||||
        this.builtInCMapCache = Object.create(null);
 | 
					        this.builtInCMapCache.clear();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user