Bug 1664888 - Update pdf.js to version 2.7.53. r=bdahl
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 14 Sep 2020 19:30:05 +0000
changeset 548608 eb49606f619e67308b235abefd7ac28e7f29570e
parent 548607 59fbb6793bb5f99fbbe09bf40268a07047b12657
child 548609 367c0d24e6bdff8e9760697122a778708410b8a8
push id126295
push userrvandermeulen@mozilla.com
push dateMon, 14 Sep 2020 20:21:13 +0000
treeherderautoland@eb49606f619e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdahl
bugs1664888
milestone82.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 1664888 - Update pdf.js to version 2.7.53. r=bdahl Differential Revision: https://phabricator.services.mozilla.com/D90147
toolkit/components/pdfjs/README.mozilla
toolkit/components/pdfjs/content/build/pdf.js
toolkit/components/pdfjs/content/build/pdf.worker.js
toolkit/components/pdfjs/moz.yaml
--- a/toolkit/components/pdfjs/README.mozilla
+++ b/toolkit/components/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.7.43
+Current extension version is: 2.7.53
 
-Taken from upstream commit: 008eed0ef
+Taken from upstream commit: 1e11f871b
--- a/toolkit/components/pdfjs/content/build/pdf.js
+++ b/toolkit/components/pdfjs/content/build/pdf.js
@@ -330,18 +330,18 @@ var _annotation_layer = __w_pdfjs_requir
 var _api_compatibility = __w_pdfjs_require__(9);
 
 var _worker_options = __w_pdfjs_require__(12);
 
 var _text_layer = __w_pdfjs_require__(20);
 
 var _svg = __w_pdfjs_require__(21);
 
-const pdfjsVersion = '2.7.43';
-const pdfjsBuild = '008eed0ef';
+const pdfjsVersion = '2.7.53';
+const pdfjsBuild = '1e11f871b';
 ;
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
@@ -1570,17 +1570,25 @@ function stringToPDFString(str) {
       strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
     }
   }
 
   return strBuf.join("");
 }
 
 function escapeString(str) {
-  return str.replace(/([\(\)\\])/g, "\\$1");
+  return str.replace(/([\(\)\\\n\r])/g, match => {
+    if (match === "\n") {
+      return "\\n";
+    } else if (match === "\r") {
+      return "\\r";
+    }
+
+    return `\\${match}`;
+  });
 }
 
 function stringToUTF8String(str) {
   return decodeURIComponent(escape(str));
 }
 
 function utf8StringToString(str) {
   return unescape(encodeURIComponent(str));
@@ -1959,17 +1967,17 @@ function _fetchDocument(worker, source, 
   if (pdfDataRangeTransport) {
     source.length = pdfDataRangeTransport.length;
     source.initialData = pdfDataRangeTransport.initialData;
     source.progressiveDone = pdfDataRangeTransport.progressiveDone;
   }
 
   return worker.messageHandler.sendWithPromise("GetDocRequest", {
     docId,
-    apiVersion: '2.7.43',
+    apiVersion: '2.7.53',
     source: {
       data: source.data,
       url: source.url,
       password: source.password,
       disableAutoFetch: source.disableAutoFetch,
       rangeChunkSize: source.rangeChunkSize,
       length: source.length
     },
@@ -3884,19 +3892,19 @@ const InternalRenderTask = function Inte
       }
     }
 
   }
 
   return InternalRenderTask;
 }();
 
-const version = '2.7.43';
+const version = '2.7.53';
 exports.version = version;
-const build = '008eed0ef';
+const build = '1e11f871b';
 exports.build = build;
 
 /***/ }),
 /* 6 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
--- a/toolkit/components/pdfjs/content/build/pdf.worker.js
+++ b/toolkit/components/pdfjs/content/build/pdf.worker.js
@@ -130,18 +130,18 @@ Object.defineProperty(exports, "WorkerMe
   enumerable: true,
   get: function () {
     return _worker.WorkerMessageHandler;
   }
 });
 
 var _worker = __w_pdfjs_require__(1);
 
-const pdfjsVersion = '2.7.43';
-const pdfjsBuild = '008eed0ef';
+const pdfjsVersion = '2.7.53';
+const pdfjsBuild = '1e11f871b';
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
@@ -226,17 +226,17 @@ class WorkerMessageHandler {
 
   static createDocumentHandler(docParams, port) {
     var pdfManager;
     var terminated = false;
     var cancelXHRs = null;
     var WorkerTasks = [];
     const verbosity = (0, _util.getVerbosityLevel)();
     const apiVersion = docParams.apiVersion;
-    const workerVersion = '2.7.43';
+    const workerVersion = '2.7.53';
 
     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";
@@ -1485,17 +1485,25 @@ function stringToPDFString(str) {
       strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
     }
   }
 
   return strBuf.join("");
 }
 
 function escapeString(str) {
-  return str.replace(/([\(\)\\])/g, "\\$1");
+  return str.replace(/([\(\)\\\n\r])/g, match => {
+    if (match === "\n") {
+      return "\\n";
+    } else if (match === "\r") {
+      return "\\r";
+    }
+
+    return `\\${match}`;
+  });
 }
 
 function stringToUTF8String(str) {
   return decodeURIComponent(escape(str));
 }
 
 function utf8StringToString(str) {
   return unescape(encodeURIComponent(str));
@@ -7840,16 +7848,20 @@ var DecodeStream = function DecodeStream
     if (maybeMinBufferLength) {
       while (this.minBufferLength < maybeMinBufferLength) {
         this.minBufferLength *= 2;
       }
     }
   }
 
   DecodeStream.prototype = {
+    get length() {
+      (0, _util.unreachable)("Should not access DecodeStream.length");
+    },
+
     get isEmpty() {
       while (!this.eof && this.bufferLength === 0) {
         this.readBlock();
       }
 
       return this.bufferLength === 0;
     },
 
--- a/toolkit/components/pdfjs/moz.yaml
+++ b/toolkit/components/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.7.43
+  release: version 2.7.53
 
   # 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