Bug 1532355 - Update pdf.js to version 2.2.51. r=bdahl
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 04 Mar 2019 12:56:11 -0500
changeset 520188 962e8a03ecba09cc14ff295977f78a76a6a5aa58
parent 520187 86c23cbb3eb148241e305a0b2372dc8a6d17195d
child 520189 8a14a69f725a823c03d38ca91c7029cae382a630
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdahl
bugs1532355
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1532355 - Update pdf.js to version 2.2.51. r=bdahl
browser/extensions/pdfjs/README.mozilla
browser/extensions/pdfjs/content/build/pdf.js
browser/extensions/pdfjs/content/build/pdf.worker.js
browser/extensions/pdfjs/moz.yaml
--- a/browser/extensions/pdfjs/README.mozilla
+++ b/browser/extensions/pdfjs/README.mozilla
@@ -1,5 +1,5 @@
 This is the PDF.js project output, https://github.com/mozilla/pdf.js
 
-Current extension version is: 2.2.42
+Current extension version is: 2.2.51
 
-Taken from upstream commit: 34022d2f
+Taken from upstream commit: c43396c2
--- a/browser/extensions/pdfjs/content/build/pdf.js
+++ b/browser/extensions/pdfjs/content/build/pdf.js
@@ -118,18 +118,18 @@ return /******/ (function(modules) { // 
 /************************************************************************/
 /******/ ([
 /* 0 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
-var pdfjsVersion = '2.2.42';
-var pdfjsBuild = '34022d2f';
+var pdfjsVersion = '2.2.51';
+var pdfjsBuild = 'c43396c2';
 
 var pdfjsSharedUtil = __w_pdfjs_require__(1);
 
 var pdfjsDisplayAPI = __w_pdfjs_require__(6);
 
 var pdfjsDisplayTextLayer = __w_pdfjs_require__(18);
 
 var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(19);
@@ -1290,17 +1290,17 @@ function _fetchDocument(worker, source, 
 
   if (pdfDataRangeTransport) {
     source.length = pdfDataRangeTransport.length;
     source.initialData = pdfDataRangeTransport.initialData;
   }
 
   return worker.messageHandler.sendWithPromise('GetDocRequest', {
     docId,
-    apiVersion: '2.2.42',
+    apiVersion: '2.2.51',
     source: {
       data: source.data,
       url: source.url,
       password: source.password,
       disableAutoFetch: source.disableAutoFetch,
       rangeChunkSize: source.rangeChunkSize,
       length: source.length
     },
@@ -3033,19 +3033,19 @@ const InternalRenderTask = function Inte
       }
     }
 
   }
 
   return InternalRenderTask;
 }();
 
-const version = '2.2.42';
+const version = '2.2.51';
 exports.version = version;
-const build = '34022d2f';
+const build = 'c43396c2';
 exports.build = build;
 
 /***/ }),
 /* 7 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
@@ -8452,38 +8452,46 @@ var renderTextLayer = function renderTex
     this._layoutTextLastFontFamily = null;
     this._layoutTextCtx = null;
     this._textDivProperties = new WeakMap();
     this._renderingDone = false;
     this._canceled = false;
     this._capability = (0, _util.createPromiseCapability)();
     this._renderTimer = null;
     this._bounds = [];
+
+    this._capability.promise.finally(() => {
+      if (this._layoutTextCtx) {
+        this._layoutTextCtx.canvas.width = 0;
+        this._layoutTextCtx.canvas.height = 0;
+        this._layoutTextCtx = null;
+      }
+    });
   }
 
   TextLayerRenderTask.prototype = {
     get promise() {
       return this._capability.promise;
     },
 
     cancel: function TextLayer_cancel() {
+      this._canceled = true;
+
       if (this._reader) {
-        this._reader.cancel(new _util.AbortException('text layer task cancelled'));
+        this._reader.cancel(new _util.AbortException('TextLayer task cancelled.'));
 
         this._reader = null;
       }
 
-      this._canceled = true;
-
       if (this._renderTimer !== null) {
         clearTimeout(this._renderTimer);
         this._renderTimer = null;
       }
 
-      this._capability.reject('canceled');
+      this._capability.reject(new Error('TextLayer task cancelled.'));
     },
 
     _processItems(items, styleCache) {
       for (let i = 0, len = items.length; i < len; i++) {
         this._textContentItemsStr.push(items[i].str);
 
         appendText(this, items[i], styleCache);
       }
--- a/browser/extensions/pdfjs/content/build/pdf.worker.js
+++ b/browser/extensions/pdfjs/content/build/pdf.worker.js
@@ -118,18 +118,18 @@ return /******/ (function(modules) { // 
 /************************************************************************/
 /******/ ([
 /* 0 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
-const pdfjsVersion = '2.2.42';
-const pdfjsBuild = '34022d2f';
+const pdfjsVersion = '2.2.51';
+const pdfjsBuild = 'c43396c2';
 
 const pdfjsCoreWorker = __w_pdfjs_require__(1);
 
 exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
@@ -372,17 +372,17 @@ var WorkerMessageHandler = {
   },
 
   createDocumentHandler(docParams, port) {
     var pdfManager;
     var terminated = false;
     var cancelXHRs = null;
     var WorkerTasks = [];
     let apiVersion = docParams.apiVersion;
-    let workerVersion = '2.2.42';
+    let workerVersion = '2.2.51';
 
     if (apiVersion !== workerVersion) {
       throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
     }
 
     var docId = docParams.docId;
     var docBaseUrl = docParams.docBaseUrl;
     var workerHandlerName = docParams.docId + '_worker';
@@ -26747,27 +26747,29 @@ var Type1Font = function Type1FontClosur
       strings.add('Version 0.11');
       strings.add('See original notice');
       strings.add(name);
       strings.add(name);
       strings.add('Medium');
       cff.strings = strings;
       cff.globalSubrIndex = new _cff_parser.CFFIndex();
       var count = glyphs.length;
-      var charsetArray = [0];
+      var charsetArray = ['.notdef'];
       var i, ii;
 
       for (i = 0; i < count; i++) {
-        var index = _cff_parser.CFFStandardStrings.indexOf(charstrings[i].glyphName);
+        let glyphName = charstrings[i].glyphName;
+
+        let index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
 
         if (index === -1) {
-          index = strings.add(charstrings[i].glyphName);
-        }
-
-        charsetArray.push(index);
+          strings.add(glyphName);
+        }
+
+        charsetArray.push(glyphName);
       }
 
       cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
       var charStringsIndex = new _cff_parser.CFFIndex();
       charStringsIndex.add([0x8B, 0x0E]);
 
       for (i = 0; i < count; i++) {
         charStringsIndex.add(glyphs[i]);
@@ -27914,17 +27916,17 @@ var CFFStrings = function CFFStringsClos
 
       if (index !== -1) {
         return index + NUM_STANDARD_CFF_STRINGS;
       }
 
       return -1;
     },
     add: function CFFStrings_add(value) {
-      return this.strings.push(value) + NUM_STANDARD_CFF_STRINGS - 1;
+      this.strings.push(value);
     },
 
     get count() {
       return this.strings.length;
     }
 
   };
   return CFFStrings;
@@ -28527,27 +28529,32 @@ var CFFCompiler = function CFFCompilerCl
       if (isCIDFont) {
         out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xFF, numGlyphsLessNotDef & 0xFF]);
       } else {
         let length = 1 + numGlyphsLessNotDef * 2;
         out = new Uint8Array(length);
         out[0] = 0;
         let charsetIndex = 0;
         let numCharsets = charset.charset.length;
+        let warned = false;
 
         for (let i = 1; i < out.length; i += 2) {
           let sid = 0;
 
           if (charsetIndex < numCharsets) {
             let name = charset.charset[charsetIndex++];
             sid = strings.getSID(name);
 
             if (sid === -1) {
               sid = 0;
-              (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
+
+              if (!warned) {
+                warned = true;
+                (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
+              }
             }
           }
 
           out[i] = sid >> 8 & 0xFF;
           out[i + 1] = sid & 0xFF;
         }
       }
 
--- a/browser/extensions/pdfjs/moz.yaml
+++ b/browser/extensions/pdfjs/moz.yaml
@@ -15,15 +15,15 @@ origin:
   description: Portable Document Format (PDF) viewer that is built with HTML5
 
   # Full URL for the package's homepage/etc
   # Usually different from repository url
   url: https://github.com/mozilla/pdf.js
 
   # Human-readable identifier for this version/release
   # Generally "version NNN", "tag SSS", "bookmark SSS"
-  release: version 2.2.42
+  release: version 2.2.51
 
   # The package's license, where possible using the mnemonic from
   # https://spdx.org/licenses/
   # Multiple licenses can be specified (as a YAML list)
   # A "LICENSE" file must exist containing the full license text
   license: Apache-2.0