Bug 1624500 - Update pdf.js to version 2.5.23. r=bdahl
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 25 Mar 2020 15:50:56 +0000
changeset 520395 73b4073fe12e1062ac6a2b64618c3c6a9fdb145c
parent 520394 b89a4862242cf93166205e15ccdff8e9c04de9b5
child 520396 cb8f33fc316772581fc4a03e02571f483c79bdaa
push id37249
push userdvarga@mozilla.com
push dateWed, 25 Mar 2020 21:39:06 +0000
treeherdermozilla-central@b3c3f7d0f044 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdahl
bugs1624500
milestone76.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 1624500 - Update pdf.js to version 2.5.23. r=bdahl Differential Revision: https://phabricator.services.mozilla.com/D67965
browser/extensions/pdfjs/README.mozilla
browser/extensions/pdfjs/content/build/pdf.js
browser/extensions/pdfjs/content/build/pdf.worker.js
browser/extensions/pdfjs/content/web/viewer.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.4.445
+Current extension version is: 2.5.23
 
-Taken from upstream commit: 1bc5cef2b
+Taken from upstream commit: 85838fc50
--- 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.4.445';
-var pdfjsBuild = '1bc5cef2b';
+var pdfjsVersion = '2.5.23';
+var pdfjsBuild = '85838fc50';
 
 var pdfjsSharedUtil = __w_pdfjs_require__(1);
 
 var pdfjsDisplayAPI = __w_pdfjs_require__(3);
 
 var pdfjsDisplayTextLayer = __w_pdfjs_require__(16);
 
 var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(17);
@@ -1213,17 +1213,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.4.445',
+    apiVersion: '2.5.23',
     source: {
       data: source.data,
       url: source.url,
       password: source.password,
       disableAutoFetch: source.disableAutoFetch,
       rangeChunkSize: source.rangeChunkSize,
       length: source.length
     },
@@ -1272,20 +1272,16 @@ const PDFDocumentLoadingTask = function 
         if (this._worker) {
           this._worker.destroy();
 
           this._worker = null;
         }
       });
     }
 
-    then(onFulfilled, onRejected) {
-      throw new Error("Removed API method: " + "PDFDocumentLoadingTask.then, use the `promise` getter instead.");
-    }
-
   }
 
   return PDFDocumentLoadingTask;
 }();
 
 class PDFDataRangeTransport {
   constructor(length, initialData, progressiveDone = false) {
     this.length = length;
@@ -1464,31 +1460,31 @@ class PDFDocumentProxy {
   }
 
 }
 
 exports.PDFDocumentProxy = PDFDocumentProxy;
 
 class PDFPageProxy {
   constructor(pageIndex, pageInfo, transport, pdfBug = false) {
-    this.pageIndex = pageIndex;
+    this._pageIndex = pageIndex;
     this._pageInfo = pageInfo;
     this._transport = transport;
     this._stats = pdfBug ? new _display_utils.StatTimer() : null;
     this._pdfBug = pdfBug;
     this.commonObjs = transport.commonObjs;
     this.objs = new PDFObjects();
     this.cleanupAfterRender = false;
     this.pendingCleanup = false;
     this.intentStates = Object.create(null);
     this.destroyed = false;
   }
 
   get pageNumber() {
-    return this.pageIndex + 1;
+    return this._pageIndex + 1;
   }
 
   get rotate() {
     return this._pageInfo.rotate;
   }
 
   get ref() {
     return this._pageInfo.ref;
@@ -1518,17 +1514,17 @@ class PDFPageProxy {
       dontFlip
     });
   }
 
   getAnnotations({
     intent = null
   } = {}) {
     if (!this.annotationsPromise || this.annotationsIntent !== intent) {
-      this.annotationsPromise = this._transport.getAnnotations(this.pageIndex, intent);
+      this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent);
       this.annotationsIntent = intent;
     }
 
     return this.annotationsPromise;
   }
 
   render({
     canvasContext,
@@ -1572,17 +1568,17 @@ class PDFPageProxy {
         lastChunk: false
       };
 
       if (this._stats) {
         this._stats.time("Page Request");
       }
 
       this._pumpOperatorList({
-        pageIndex: this.pageNumber - 1,
+        pageIndex: this._pageIndex,
         intent: renderingIntent,
         renderInteractiveForms: renderInteractiveForms === true
       });
     }
 
     const complete = error => {
       const i = intentState.renderTasks.indexOf(internalRenderTask);
 
@@ -1621,17 +1617,17 @@ class PDFPageProxy {
         viewport,
         transform,
         imageLayer,
         background
       },
       objs: this.objs,
       commonObjs: this.commonObjs,
       operatorList: intentState.operatorList,
-      pageNumber: this.pageNumber,
+      pageIndex: this._pageIndex,
       canvasFactory: canvasFactoryInstance,
       webGLContext,
       useRequestAnimationFrame: renderingIntent !== "print",
       pdfBug: this._pdfBug
     });
 
     if (!intentState.renderTasks) {
       intentState.renderTasks = [];
@@ -1688,31 +1684,31 @@ class PDFPageProxy {
         lastChunk: false
       };
 
       if (this._stats) {
         this._stats.time("Page Request");
       }
 
       this._pumpOperatorList({
-        pageIndex: this.pageIndex,
+        pageIndex: this._pageIndex,
         intent: renderingIntent
       });
     }
 
     return intentState.opListReadCapability.promise;
   }
 
   streamTextContent({
     normalizeWhitespace = false,
     disableCombineTextItems = false
   } = {}) {
     const TEXT_CONTENT_CHUNK_SIZE = 100;
     return this._transport.messageHandler.sendWithStream("GetTextContent", {
-      pageIndex: this.pageNumber - 1,
+      pageIndex: this._pageIndex,
       normalizeWhitespace: normalizeWhitespace === true,
       combineTextItems: disableCombineTextItems !== true
     }, {
       highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
 
       size(textContent) {
         return textContent.items.length;
       }
@@ -1745,17 +1741,17 @@ class PDFPageProxy {
         styles: Object.create(null)
       };
       pump();
     });
   }
 
   _destroy() {
     this.destroyed = true;
-    this._transport.pageCache[this.pageIndex] = null;
+    this._transport.pageCache[this._pageIndex] = null;
     const waitOn = [];
     Object.keys(this.intentStates).forEach(intent => {
       const intentState = this.intentStates[intent];
 
       this._abortOperatorList({
         intentState,
         reason: new Error("Page was destroyed."),
         force: true
@@ -2676,27 +2672,25 @@ class WorkerTransport {
       if (loadingTask.onProgress) {
         loadingTask.onProgress({
           loaded: data.loaded,
           total: data.total
         });
       }
     });
     messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this));
-    messageHandler.on("JpegDecode", data => {
+    messageHandler.on("JpegDecode", ([imageUrl, components]) => {
       if (this.destroyed) {
         return Promise.reject(new Error("Worker was destroyed"));
       }
 
       if (typeof document === "undefined") {
         return Promise.reject(new Error('"document" is not defined.'));
       }
 
-      const [imageUrl, components] = data;
-
       if (components !== 3 && components !== 1) {
         return Promise.reject(new Error("Only 3 components or 1 component can be returned"));
       }
 
       return new Promise(function (resolve, reject) {
         const img = new Image();
 
         img.onload = function () {
@@ -2993,45 +2987,41 @@ class RenderTask {
   get promise() {
     return this._internalRenderTask.capability.promise;
   }
 
   cancel() {
     this._internalRenderTask.cancel();
   }
 
-  then(onFulfilled, onRejected) {
-    throw new Error("Removed API method: " + "RenderTask.then, use the `promise` getter instead.");
-  }
-
 }
 
 const InternalRenderTask = function InternalRenderTaskClosure() {
   const canvasInRendering = new WeakSet();
 
   class InternalRenderTask {
     constructor({
       callback,
       params,
       objs,
       commonObjs,
       operatorList,
-      pageNumber,
+      pageIndex,
       canvasFactory,
       webGLContext,
       useRequestAnimationFrame = false,
       pdfBug = false
     }) {
       this.callback = callback;
       this.params = params;
       this.objs = objs;
       this.commonObjs = commonObjs;
       this.operatorListIdx = null;
       this.operatorList = operatorList;
-      this.pageNumber = pageNumber;
+      this._pageIndex = pageIndex;
       this.canvasFactory = canvasFactory;
       this.webGLContext = webGLContext;
       this._pdfBug = pdfBug;
       this.running = false;
       this.graphicsReadyCallback = null;
       this.graphicsReady = false;
       this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
       this.cancelled = false;
@@ -3052,17 +3042,17 @@ const InternalRenderTask = function Inte
         if (canvasInRendering.has(this._canvas)) {
           throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed.");
         }
 
         canvasInRendering.add(this._canvas);
       }
 
       if (this._pdfBug && globalThis.StepperManager && globalThis.StepperManager.enabled) {
-        this.stepper = globalThis.StepperManager.create(this.pageNumber - 1);
+        this.stepper = globalThis.StepperManager.create(this._pageIndex);
         this.stepper.init(this.operatorList);
         this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
       }
 
       const {
         canvasContext,
         viewport,
         transform,
@@ -3091,17 +3081,17 @@ const InternalRenderTask = function Inte
       if (this.gfx) {
         this.gfx.endDrawing();
       }
 
       if (this._canvas) {
         canvasInRendering.delete(this._canvas);
       }
 
-      this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this.pageNumber}`, "canvas"));
+      this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, "canvas"));
     }
 
     operatorListChanged() {
       if (!this.graphicsReady) {
         if (!this.graphicsReadyCallback) {
           this.graphicsReadyCallback = this._continueBound;
         }
 
@@ -3165,19 +3155,19 @@ const InternalRenderTask = function Inte
       }
     }
 
   }
 
   return InternalRenderTask;
 }();
 
-const version = '2.4.445';
+const version = '2.5.23';
 exports.version = version;
-const build = '1bc5cef2b';
+const build = '85838fc50';
 exports.build = build;
 
 /***/ }),
 /* 4 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
@@ -4214,22 +4204,22 @@ function compileType3Glyph(imgData) {
   }
 
   var drawOutline = function (c) {
     c.save();
     c.scale(1 / width, -1 / height);
     c.translate(0, -height);
     c.beginPath();
 
-    for (var i = 0, ii = outlines.length; i < ii; i++) {
-      var o = outlines[i];
+    for (let k = 0, kk = outlines.length; k < kk; k++) {
+      var o = outlines[k];
       c.moveTo(o[0], o[1]);
 
-      for (var j = 2, jj = o.length; j < jj; j += 2) {
-        c.lineTo(o[j], o[j + 1]);
+      for (let l = 2, ll = o.length; l < ll; l += 2) {
+        c.lineTo(o[l], o[l + 1]);
       }
     }
 
     c.fill();
     c.beginPath();
     c.restore();
   };
 
@@ -6144,17 +6134,17 @@ var createMeshCanvas = function createMe
       cbr = c1r - (c1r - c3r) * k;
       cbg = c1g - (c1g - c3g) * k;
       cbb = c1b - (c1b - c3b) * k;
       var x1_ = Math.round(Math.min(xa, xb));
       var x2_ = Math.round(Math.max(xa, xb));
       var j = rowSize * y + x1_ * 4;
 
       for (var x = x1_; x <= x2_; x++) {
-        let k = (xa - x) / (xa - xb);
+        k = (xa - x) / (xa - xb);
 
         if (k < 0) {
           k = 0;
         } else if (k > 1) {
           k = 1;
         }
 
         bytes[j++] = car - (car - cbr) * k | 0;
@@ -8515,16 +8505,30 @@ var renderTextLayer = function renderTex
         task._layoutText(textDivs[i]);
       }
     }
 
     task._renderingDone = true;
     capability.resolve();
   }
 
+  function findPositiveMin(ts, offset, count) {
+    let result = 0;
+
+    for (let i = 0; i < count; i++) {
+      const t = ts[offset++];
+
+      if (t > 0) {
+        result = result ? Math.min(t, result) : t;
+      }
+    }
+
+    return result;
+  }
+
   function expand(task) {
     var bounds = task._bounds;
     var viewport = task._viewport;
     var expanded = expandBounds(viewport.width, viewport.height, bounds);
 
     for (var i = 0; i < expanded.length; i++) {
       var div = bounds[i].div;
 
@@ -8543,51 +8547,36 @@ var renderTextLayer = function renderTex
 
       var e = expanded[i],
           b = bounds[i];
       var m = b.m,
           c = m[0],
           s = m[1];
       var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];
       var ts = new Float64Array(64);
-      points.forEach(function (p, i) {
+      points.forEach(function (p, j) {
         var t = _util.Util.applyTransform(p, m);
 
-        ts[i + 0] = c && (e.left - t[0]) / c;
-        ts[i + 4] = s && (e.top - t[1]) / s;
-        ts[i + 8] = c && (e.right - t[0]) / c;
-        ts[i + 12] = s && (e.bottom - t[1]) / s;
-        ts[i + 16] = s && (e.left - t[0]) / -s;
-        ts[i + 20] = c && (e.top - t[1]) / c;
-        ts[i + 24] = s && (e.right - t[0]) / -s;
-        ts[i + 28] = c && (e.bottom - t[1]) / c;
-        ts[i + 32] = c && (e.left - t[0]) / -c;
-        ts[i + 36] = s && (e.top - t[1]) / -s;
-        ts[i + 40] = c && (e.right - t[0]) / -c;
-        ts[i + 44] = s && (e.bottom - t[1]) / -s;
-        ts[i + 48] = s && (e.left - t[0]) / s;
-        ts[i + 52] = c && (e.top - t[1]) / -c;
-        ts[i + 56] = s && (e.right - t[0]) / s;
-        ts[i + 60] = c && (e.bottom - t[1]) / -c;
+        ts[j + 0] = c && (e.left - t[0]) / c;
+        ts[j + 4] = s && (e.top - t[1]) / s;
+        ts[j + 8] = c && (e.right - t[0]) / c;
+        ts[j + 12] = s && (e.bottom - t[1]) / s;
+        ts[j + 16] = s && (e.left - t[0]) / -s;
+        ts[j + 20] = c && (e.top - t[1]) / c;
+        ts[j + 24] = s && (e.right - t[0]) / -s;
+        ts[j + 28] = c && (e.bottom - t[1]) / c;
+        ts[j + 32] = c && (e.left - t[0]) / -c;
+        ts[j + 36] = s && (e.top - t[1]) / -s;
+        ts[j + 40] = c && (e.right - t[0]) / -c;
+        ts[j + 44] = s && (e.bottom - t[1]) / -s;
+        ts[j + 48] = s && (e.left - t[0]) / s;
+        ts[j + 52] = c && (e.top - t[1]) / -c;
+        ts[j + 56] = s && (e.right - t[0]) / s;
+        ts[j + 60] = c && (e.bottom - t[1]) / -c;
       });
-
-      var findPositiveMin = function (ts, offset, count) {
-        var result = 0;
-
-        for (var i = 0; i < count; i++) {
-          var t = ts[offset++];
-
-          if (t > 0) {
-            result = result ? Math.min(t, result) : t;
-          }
-        }
-
-        return result;
-      };
-
       var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
       divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;
       divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;
       divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale;
       divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale;
 
       task._textDivProperties.set(div, divProperties);
     }
--- 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.4.445';
-const pdfjsBuild = '1bc5cef2b';
+const pdfjsVersion = '2.5.23';
+const pdfjsBuild = '85838fc50';
 
 const pdfjsCoreWorker = __w_pdfjs_require__(1);
 
 exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
@@ -218,17 +218,17 @@ var WorkerMessageHandler = {
 
   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.4.445';
+    const workerVersion = '2.5.23';
 
     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";
@@ -6597,17 +6597,17 @@ class Lexer {
       }
     }
 
     if (divideBy !== 0) {
       baseValue /= divideBy;
     }
 
     if (eNotation) {
-      baseValue *= Math.pow(10, powerValueSign * powerValue);
+      baseValue *= 10 ** (powerValueSign * powerValue);
     }
 
     return sign * baseValue;
   }
 
   getString() {
     let numParen = 1;
     let done = false;
@@ -14797,17 +14797,17 @@ var JpxImage = function JpxImageClosure(
         } else {
           mu = spqcds[b].mu;
           epsilon = spqcds[b].epsilon;
           b++;
         }
 
         var subband = resolution.subbands[j];
         var gainLog2 = SubbandsGainLog2[subband.type];
-        var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
+        var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
         var mb = guardBits + epsilon - 1;
         copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
       }
 
       subbandCoefficients.push({
         width,
         height,
         items: coefficients
@@ -17899,19 +17899,19 @@ const DeviceCmykCS = function DeviceCmyk
   }
 
   return DeviceCmykCS;
 }();
 
 const CalGrayCS = function CalGrayCSClosure() {
   function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
     const A = src[srcOffset] * scale;
-    const AG = Math.pow(A, cs.G);
+    const AG = A ** cs.G;
     const L = cs.YW * AG;
-    const val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0);
+    const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
     dest[destOffset] = val;
     dest[destOffset + 1] = val;
     dest[destOffset + 2] = val;
   }
 
   class CalGrayCS extends ColorSpace {
     constructor(whitePoint, blackPoint, gamma) {
       super("CalGray", 1);
@@ -17975,17 +17975,17 @@ const CalGrayCS = function CalGrayCSClos
 const CalRGBCS = function CalRGBCSClosure() {
   const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
   const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
   const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
   const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
   const tempNormalizeMatrix = new Float32Array(3);
   const tempConvertMatrix1 = new Float32Array(3);
   const tempConvertMatrix2 = new Float32Array(3);
-  const DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
+  const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
 
   function matrixProduct(a, b, result) {
     result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
     result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
     result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
   }
 
   function convertToFlat(sourceWhitePoint, LMS, result) {
@@ -18003,30 +18003,30 @@ const CalRGBCS = function CalRGBCSClosur
     result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
   }
 
   function sRGBTransferFunction(color) {
     if (color <= 0.0031308) {
       return adjustToRange(0, 1, 12.92 * color);
     }
 
-    return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
+    return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
   }
 
   function adjustToRange(min, max, value) {
     return Math.max(min, Math.min(max, value));
   }
 
   function decodeL(L) {
     if (L < 0) {
       return -decodeL(-L);
     }
 
     if (L > 8.0) {
-      return Math.pow((L + 16) / 116, 3);
+      return ((L + 16) / 116) ** 3;
     }
 
     return L * DECODE_L_CONSTANT;
   }
 
   function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
     if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
       result[0] = XYZ_Flat[0];
@@ -18075,19 +18075,19 @@ const CalRGBCS = function CalRGBCSClosur
     convertToD65(sourceWhitePoint, LMS, LMS_D65);
     matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
   }
 
   function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
     const A = adjustToRange(0, 1, src[srcOffset] * scale);
     const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
     const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
-    const AGR = Math.pow(A, cs.GR);
-    const BGG = Math.pow(B, cs.GG);
-    const CGB = Math.pow(C, cs.GB);
+    const AGR = A ** cs.GR;
+    const BGG = B ** cs.GG;
+    const CGB = C ** cs.GB;
     const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
     const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
     const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
     const XYZ = tempConvertMatrix1;
     XYZ[0] = X;
     XYZ[1] = Y;
     XYZ[2] = Z;
     const XYZ_Flat = tempConvertMatrix2;
@@ -22792,17 +22792,16 @@ var PartialEvaluator = function PartialE
         name: fontName.name,
         subtype,
         file: fontFile,
         length1,
         length2,
         length3,
         loadedName: baseDict.loadedName,
         composite,
-        wideChars: composite,
         fixedPitch: false,
         fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
         firstChar: firstChar || 0,
         lastChar: lastChar || maxCharIndex,
         bbox: descriptor.getArray("FontBBox"),
         ascent: descriptor.get("Ascent"),
         descent: descriptor.get("Descent"),
         xHeight: descriptor.get("XHeight"),
@@ -24918,17 +24917,16 @@ var Font = function FontClosure() {
       fallbackName = "serif";
     }
 
     this.fallbackName = fallbackName;
     this.differences = properties.differences;
     this.widths = properties.widths;
     this.defaultWidth = properties.defaultWidth;
     this.composite = properties.composite;
-    this.wideChars = properties.wideChars;
     this.cMap = properties.cMap;
     this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
     this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
     this.fontMatrix = properties.fontMatrix;
     this.bbox = properties.bbox;
     this.defaultEncoding = properties.defaultEncoding;
     this.toUnicode = properties.toUnicode;
     this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
@@ -25438,17 +25436,17 @@ var Font = function FontClosure() {
     }
 
     var winAscent = override.yMax || typoAscent;
     var winDescent = -override.yMin || -typoDescent;
     return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
   }
 
   function createPostTable(properties) {
-    var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
+    var angle = Math.floor(properties.italicAngle * 2 ** 16);
     return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
   }
 
   function createNameTable(name, proto) {
     if (!proto) {
       proto = [[], []];
     }
 
@@ -42826,17 +42824,17 @@ var PDFFunction = function PDFFunctionCl
       for (i = 0, ii = size.length; i < ii; i++) {
         length *= size[i];
       }
 
       length *= outputSize;
       var array = new Array(length);
       var codeSize = 0;
       var codeBuf = 0;
-      var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
+      var sampleMul = 1.0 / (2.0 ** bps - 1);
       var strBytes = stream.getBytes((length * bps + 7) / 8);
       var strIdx = 0;
 
       for (i = 0; i < length; i++) {
         while (codeSize < bps) {
           codeBuf <<= 8;
           codeBuf |= strBytes[strIdx++];
           codeSize += 8;
@@ -43016,17 +43014,17 @@ var PDFFunction = function PDFFunctionCl
 
       if (!decode) {
         decode = range;
       } else {
         decode = toMultiArray(decode);
       }
 
       var samples = this.getSampleArray(size, outputSize, bps, fn);
-      return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, Math.pow(2, bps) - 1, range];
+      return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
     },
 
     constructSampledFromIR({
       xref,
       isEvalSupported,
       IR
     }) {
       function interpolate(x, xmin, xmax, ymin, ymax) {
@@ -43118,17 +43116,17 @@ var PDFFunction = function PDFFunctionCl
       isEvalSupported,
       IR
     }) {
       var c0 = IR[1];
       var diff = IR[2];
       var n = IR[3];
       var length = diff.length;
       return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
-        var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
+        var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
 
         for (var j = 0; j < length; ++j) {
           dest[destOffset + j] = c0[j] + x * diff[j];
         }
       };
     },
 
     constructStiched({
@@ -43513,17 +43511,17 @@ var PostScriptEvaluator = function PostS
 
           case "exch":
             stack.roll(2, 1);
             break;
 
           case "exp":
             b = stack.pop();
             a = stack.pop();
-            stack.push(Math.pow(a, b));
+            stack.push(a ** b);
             break;
 
           case "false":
             stack.push(false);
             break;
 
           case "floor":
             a = stack.pop();
--- a/browser/extensions/pdfjs/content/web/viewer.js
+++ b/browser/extensions/pdfjs/content/web/viewer.js
@@ -1061,43 +1061,44 @@ const PDFViewerApplication = {
         });
       });
     });
     const pageLayoutPromise = pdfDocument.getPageLayout().catch(function () {});
     const pageModePromise = pdfDocument.getPageMode().catch(function () {});
     const openActionPromise = pdfDocument.getOpenAction().catch(function () {});
     this.toolbar.setPagesCount(pdfDocument.numPages, false);
     this.secondaryToolbar.setPagesCount(pdfDocument.numPages);
-    const store = this.store = new _view_history.ViewHistory(pdfDocument.fingerprint);
     let baseDocumentUrl;
     baseDocumentUrl = this.baseUrl;
     this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);
     this.pdfDocumentProperties.setDocument(pdfDocument, this.url);
     const pdfViewer = this.pdfViewer;
     pdfViewer.setDocument(pdfDocument);
     const {
       firstPagePromise,
       onePageRendered,
       pagesPromise
     } = pdfViewer;
     const pdfThumbnailViewer = this.pdfThumbnailViewer;
     pdfThumbnailViewer.setDocument(pdfDocument);
+    const storedPromise = (this.store = new _view_history.ViewHistory(pdfDocument.fingerprint)).getMultiple({
+      page: null,
+      zoom: _ui_utils.DEFAULT_SCALE_VALUE,
+      scrollLeft: "0",
+      scrollTop: "0",
+      rotation: null,
+      sidebarView: _pdf_sidebar.SidebarView.UNKNOWN,
+      scrollMode: _ui_utils.ScrollMode.UNKNOWN,
+      spreadMode: _ui_utils.SpreadMode.UNKNOWN
+    }).catch(() => {
+      return Object.create(null);
+    });
     firstPagePromise.then(pdfPage => {
       this.loadingBar.setWidth(this.appConfig.viewerContainer);
-      const storePromise = store.getMultiple({
-        page: null,
-        zoom: _ui_utils.DEFAULT_SCALE_VALUE,
-        scrollLeft: "0",
-        scrollTop: "0",
-        rotation: null,
-        sidebarView: _pdf_sidebar.SidebarView.UNKNOWN,
-        scrollMode: _ui_utils.ScrollMode.UNKNOWN,
-        spreadMode: _ui_utils.SpreadMode.UNKNOWN
-      }).catch(() => {});
-      Promise.all([_ui_utils.animationStarted, storePromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, values = {}, pageLayout, pageMode, openAction]) => {
+      Promise.all([_ui_utils.animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {
         const viewOnLoad = _app_options.AppOptions.get("viewOnLoad");
 
         this._initializePdfHistory({
           fingerprint: pdfDocument.fingerprint,
           viewOnLoad,
           initialDest: openAction && openAction.dest
         });
 
@@ -1109,30 +1110,30 @@ const PDFViewerApplication = {
         let rotation = null;
 
         let sidebarView = _app_options.AppOptions.get("sidebarViewOnLoad");
 
         let scrollMode = _app_options.AppOptions.get("scrollModeOnLoad");
 
         let spreadMode = _app_options.AppOptions.get("spreadModeOnLoad");
 
-        if (values.page && viewOnLoad !== ViewOnLoad.INITIAL) {
-          hash = `page=${values.page}&zoom=${zoom || values.zoom},` + `${values.scrollLeft},${values.scrollTop}`;
-          rotation = parseInt(values.rotation, 10);
+        if (stored.page && viewOnLoad !== ViewOnLoad.INITIAL) {
+          hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`;
+          rotation = parseInt(stored.rotation, 10);
 
           if (sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) {
-            sidebarView = values.sidebarView | 0;
+            sidebarView = stored.sidebarView | 0;
           }
 
           if (scrollMode === _ui_utils.ScrollMode.UNKNOWN) {
-            scrollMode = values.scrollMode | 0;
+            scrollMode = stored.scrollMode | 0;
           }
 
           if (spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
-            spreadMode = values.spreadMode | 0;
+            spreadMode = stored.spreadMode | 0;
           }
         }
 
         if (pageMode && sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) {
           sidebarView = apiPageModeToSidebarView(pageMode);
         }
 
         if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
@@ -1197,20 +1198,16 @@ const PDFViewerApplication = {
       }
 
       pdfViewer.setPageLabels(labels);
       pdfThumbnailViewer.setPageLabels(labels);
       this.toolbar.setPagesCount(pdfDocument.numPages, true);
       this.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
     });
     pagesPromise.then(async () => {
-      if (!this.supportsPrinting) {
-        return;
-      }
-
       const [openAction, javaScript] = await Promise.all([openActionPromise, pdfDocument.getJavaScript()]);
       let triggerAutoPrint = false;
 
       if (openAction && openAction.action === "Print") {
         triggerAutoPrint = true;
       }
 
       if (javaScript) {
@@ -1229,16 +1226,20 @@ const PDFViewerApplication = {
             if (js && _ui_utils.AutoPrintRegExp.test(js)) {
               triggerAutoPrint = true;
               break;
             }
           }
         }
       }
 
+      if (!this.supportsPrinting) {
+        return;
+      }
+
       if (triggerAutoPrint) {
         setTimeout(function () {
           window.print();
         });
       }
     });
     onePageRendered.then(() => {
       pdfDocument.getOutline().then(outline => {
@@ -1503,18 +1504,16 @@ const PDFViewerApplication = {
     eventBus._on("pagemode", webViewerPageMode);
 
     eventBus._on("namedaction", webViewerNamedAction);
 
     eventBus._on("presentationmodechanged", webViewerPresentationModeChanged);
 
     eventBus._on("presentationmode", webViewerPresentationMode);
 
-    eventBus._on("openfile", webViewerOpenFile);
-
     eventBus._on("print", webViewerPrint);
 
     eventBus._on("download", webViewerDownload);
 
     eventBus._on("firstpage", webViewerFirstPage);
 
     eventBus._on("lastpage", webViewerLastPage);
 
@@ -1627,18 +1626,16 @@ const PDFViewerApplication = {
     eventBus._off("pagemode", webViewerPageMode);
 
     eventBus._off("namedaction", webViewerNamedAction);
 
     eventBus._off("presentationmodechanged", webViewerPresentationModeChanged);
 
     eventBus._off("presentationmode", webViewerPresentationMode);
 
-    eventBus._off("openfile", webViewerOpenFile);
-
     eventBus._off("print", webViewerPrint);
 
     eventBus._off("download", webViewerDownload);
 
     eventBus._off("firstpage", webViewerFirstPage);
 
     eventBus._off("lastpage", webViewerLastPage);
 
@@ -1955,25 +1952,23 @@ function webViewerHashchange(evt) {
 
   if (!PDFViewerApplication.isInitialViewSet) {
     PDFViewerApplication.initialBookmark = hash;
   } else if (!PDFViewerApplication.pdfHistory.popStateInProgress) {
     PDFViewerApplication.pdfLinkService.setHash(hash);
   }
 }
 
-let webViewerFileInputChange;
+let webViewerFileInputChange, webViewerOpenFile;
 ;
 
 function webViewerPresentationMode() {
   PDFViewerApplication.requestPresentationMode();
 }
 
-function webViewerOpenFile() {}
-
 function webViewerPrint() {
   window.print();
 }
 
 function webViewerDownload() {
   PDFViewerApplication.download();
 }
 
@@ -4771,31 +4766,26 @@ class PDFDocumentProperties {
     this.overlayName = overlayName;
     this.fields = fields;
     this.container = container;
     this.overlayManager = overlayManager;
     this.l10n = l10n;
 
     this._reset();
 
-    if (closeButton) {
-      closeButton.addEventListener("click", this.close.bind(this));
-    }
-
+    closeButton.addEventListener("click", this.close.bind(this));
     this.overlayManager.register(this.overlayName, this.container, this.close.bind(this));
 
-    if (eventBus) {
-      eventBus._on("pagechanging", evt => {
-        this._currentPageNumber = evt.pageNumber;
-      });
-
-      eventBus._on("rotationchanging", evt => {
-        this._pagesRotation = evt.pagesRotation;
-      });
-    }
+    eventBus._on("pagechanging", evt => {
+      this._currentPageNumber = evt.pageNumber;
+    });
+
+    eventBus._on("rotationchanging", evt => {
+      this._pagesRotation = evt.pagesRotation;
+    });
 
     this._isNonMetricLocale = true;
     l10n.getLanguage().then(locale => {
       this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale);
     });
   }
 
   open() {
@@ -7589,17 +7579,19 @@ class PDFPresentationMode {
     this.showControlsBind = this._showControls.bind(this);
     this.mouseDownBind = this._mouseDown.bind(this);
     this.mouseWheelBind = this._mouseWheel.bind(this);
     this.resetMouseScrollStateBind = this._resetMouseScrollState.bind(this);
     this.contextMenuBind = this._contextMenu.bind(this);
     this.touchSwipeBind = this._touchSwipe.bind(this);
     window.addEventListener("mousemove", this.showControlsBind);
     window.addEventListener("mousedown", this.mouseDownBind);
-    window.addEventListener("wheel", this.mouseWheelBind);
+    window.addEventListener("wheel", this.mouseWheelBind, {
+      passive: false
+    });
     window.addEventListener("keydown", this.resetMouseScrollStateBind);
     window.addEventListener("contextmenu", this.contextMenuBind);
     window.addEventListener("touchstart", this.touchSwipeBind);
     window.addEventListener("touchmove", this.touchSwipeBind);
     window.addEventListener("touchend", this.touchSwipeBind);
   }
 
   _removeWindowListeners() {
@@ -11420,33 +11412,32 @@ exports.ViewHistory = void 0;
 const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
 
 class ViewHistory {
   constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {
     this.fingerprint = fingerprint;
     this.cacheSize = cacheSize;
     this._initializedPromise = this._readFromStorage().then(databaseStr => {
       const database = JSON.parse(databaseStr || "{}");
-
-      if (!("files" in database)) {
+      let index = -1;
+
+      if (!Array.isArray(database.files)) {
         database.files = [];
       } else {
         while (database.files.length >= this.cacheSize) {
           database.files.shift();
         }
-      }
-
-      let index = -1;
-
-      for (let i = 0, length = database.files.length; i < length; i++) {
-        const branch = database.files[i];
-
-        if (branch.fingerprint === this.fingerprint) {
-          index = i;
-          break;
+
+        for (let i = 0, ii = database.files.length; i < ii; i++) {
+          const branch = database.files[i];
+
+          if (branch.fingerprint === this.fingerprint) {
+            index = i;
+            break;
+          }
         }
       }
 
       if (index === -1) {
         index = database.files.push({
           fingerprint: this.fingerprint
         }) - 1;
       }
--- 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.4.445
+  release: version 2.5.23
 
   # 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