Bug 1517826 - Update pdf.js to version 2.1.153. r=bdahl
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 04 Jan 2019 14:21:44 -0500
changeset 452610 1b508a44e699f02353c230b7021136bfd18a800c
parent 452609 0f6a3dd2c2f744df7865325e9396508ac3f8209e
child 452611 9a4aab87dc85ec697a804bd0934bb8ae22908dcd
push id35316
push usershindli@mozilla.com
push dateSat, 05 Jan 2019 04:03:40 +0000
treeherdermozilla-central@e0a4fe89a7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdahl
bugs1517826
milestone66.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 1517826 - Update pdf.js to version 2.1.153. 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.1.145
+Current extension version is: 2.1.153
 
-Taken from upstream commit: d8f201ea
+Taken from upstream commit: 5a2bd9fc
--- 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.1.145';
-var pdfjsBuild = 'd8f201ea';
+var pdfjsVersion = '2.1.153';
+var pdfjsBuild = '5a2bd9fc';
 
 var pdfjsSharedUtil = __w_pdfjs_require__(1);
 
 var pdfjsDisplayAPI = __w_pdfjs_require__(7);
 
 var pdfjsDisplayTextLayer = __w_pdfjs_require__(19);
 
 var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(20);
@@ -5149,17 +5149,17 @@ function _fetchDocument(worker, source, 
 
   if (pdfDataRangeTransport) {
     source.length = pdfDataRangeTransport.length;
     source.initialData = pdfDataRangeTransport.initialData;
   }
 
   return worker.messageHandler.sendWithPromise('GetDocRequest', {
     docId,
-    apiVersion: '2.1.145',
+    apiVersion: '2.1.153',
     source: {
       data: source.data,
       url: source.url,
       password: source.password,
       disableAutoFetch: source.disableAutoFetch,
       rangeChunkSize: source.rangeChunkSize,
       length: source.length
     },
@@ -6880,19 +6880,19 @@ const InternalRenderTask = function Inte
       }
     }
 
   }
 
   return InternalRenderTask;
 }();
 
-const version = '2.1.145';
+const version = '2.1.153';
 exports.version = version;
-const build = 'd8f201ea';
+const build = '5a2bd9fc';
 exports.build = build;
 
 /***/ }),
 /* 8 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
@@ -10973,22 +10973,28 @@ class SimpleDOMNode {
     this.nodeValue = nodeValue;
     Object.defineProperty(this, 'parentNode', {
       value: null,
       writable: true
     });
   }
 
   get firstChild() {
-    return this.childNodes[0];
+    return this.childNodes && this.childNodes[0];
   }
 
   get nextSibling() {
-    let index = this.parentNode.childNodes.indexOf(this);
-    return this.parentNode.childNodes[index + 1];
+    const childNodes = this.parentNode.childNodes;
+
+    if (!childNodes) {
+      return undefined;
+    }
+
+    const index = childNodes.indexOf(this);
+    return childNodes[index + 1];
   }
 
   get textContent() {
     if (!this.childNodes) {
       return this.nodeValue || '';
     }
 
     return this.childNodes.map(function (child) {
--- 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";
 
 
-var pdfjsVersion = '2.1.145';
-var pdfjsBuild = 'd8f201ea';
+var pdfjsVersion = '2.1.153';
+var pdfjsBuild = '5a2bd9fc';
 
 var pdfjsCoreWorker = __w_pdfjs_require__(1);
 
 exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
@@ -370,17 +370,17 @@ var WorkerMessageHandler = {
   },
 
   createDocumentHandler(docParams, port) {
     var pdfManager;
     var terminated = false;
     var cancelXHRs = null;
     var WorkerTasks = [];
     let apiVersion = docParams.apiVersion;
-    let workerVersion = '2.1.145';
+    let workerVersion = '2.1.153';
 
     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';
@@ -6942,18 +6942,18 @@ class PDFDocument {
         this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
       }
 
       hash = (0, _crypto.calculateMD5)(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
     }
 
     let fingerprint = '';
 
-    for (const hashPart of hash) {
-      const hex = hashPart.toString(16);
+    for (let i = 0, ii = hash.length; i < ii; i++) {
+      const hex = hash[i].toString(16);
       fingerprint += hex.length === 1 ? '0' + hex : hex;
     }
 
     return (0, _util.shadow)(this, 'fingerprint', fingerprint);
   }
 
   _getLinearizationPage(pageIndex) {
     const {
@@ -31083,16 +31083,23 @@ var CFFParser = function CFFParserClosur
           return true;
         } else {
           validationCommand = CharstringValidationData[value];
         }
 
         if (validationCommand) {
           if (validationCommand.stem) {
             state.hints += stackSize >> 1;
+
+            if (value === 3 || value === 23) {
+              state.hasVStems = true;
+            } else if (state.hasVStems && (value === 1 || value === 18)) {
+              (0, _util.warn)('CFF stem hints are in wrong order');
+              data[j - 1] = value === 1 ? 3 : 23;
+            }
           }
 
           if ('min' in validationCommand) {
             if (!state.undefStack && stackSize < validationCommand.min) {
               (0, _util.warn)('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
               return false;
             }
           }
@@ -31152,17 +31159,18 @@ var CFFParser = function CFFParserClosur
         var state = {
           callDepth: 0,
           stackSize: 0,
           stack: [],
           undefStack: true,
           hints: 0,
           firstStackClearing: true,
           seac: null,
-          width: null
+          width: null,
+          hasVStems: false
         };
         var valid = true;
         var localSubrToUse = null;
         var privateDictToUse = privateDict;
 
         if (fdSelect && fdArray.length) {
           var fdIndex = fdSelect.getFDIndex(i);
 
--- 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.1.145
+  release: version 2.1.153
 
   # 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