Merge mozilla-central to autoland. a=merge CLOSED TREE
authorOana Pop Rus <opoprus@mozilla.com>
Tue, 12 Mar 2019 00:00:40 +0200
changeset 521439 e2b7138d7c24c2be4985e8d0acbeab2ecf387b18
parent 521438 3e745bcded68e06bb69a9de9feb8ed43613d31a3 (current diff)
parent 521360 52b03bc3489944b2f695b79754615edf7d38bd27 (diff)
child 521440 583048926c121b876326a536f44e14034035372c
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
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
Merge mozilla-central to autoland. a=merge CLOSED TREE
--- 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.51
+Current extension version is: 2.2.67
 
-Taken from upstream commit: c43396c2
+Taken from upstream commit: d587abbc
--- 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.51';
-var pdfjsBuild = 'c43396c2';
+var pdfjsVersion = '2.2.67';
+var pdfjsBuild = 'd587abbc';
 
 var pdfjsSharedUtil = __w_pdfjs_require__(1);
 
 var pdfjsDisplayAPI = __w_pdfjs_require__(6);
 
 var pdfjsDisplayTextLayer = __w_pdfjs_require__(18);
 
 var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(19);
@@ -188,17 +188,16 @@ exports.apiCompatibilityParams = pdfjsDi
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
 exports.arrayByteLength = arrayByteLength;
 exports.arraysToBytes = arraysToBytes;
 exports.assert = assert;
 exports.bytesToString = bytesToString;
 exports.createPromiseCapability = createPromiseCapability;
-exports.deprecated = deprecated;
 exports.getVerbosityLevel = getVerbosityLevel;
 exports.info = info;
 exports.isArrayBuffer = isArrayBuffer;
 exports.isBool = isBool;
 exports.isEmptyObj = isEmptyObj;
 exports.isNum = isNum;
 exports.isString = isString;
 exports.isSpace = isSpace;
@@ -518,20 +517,16 @@ function info(msg) {
 }
 
 function warn(msg) {
   if (verbosity >= VerbosityLevel.WARNINGS) {
     console.log('Warning: ' + msg);
   }
 }
 
-function deprecated(details) {
-  console.log('Deprecated API usage: ' + details);
-}
-
 function unreachable(msg) {
   throw new Error(msg);
 }
 
 function assert(cond, msg) {
   if (!cond) {
     unreachable(msg);
   }
@@ -1290,17 +1285,17 @@ function _fetchDocument(worker, source, 
 
   if (pdfDataRangeTransport) {
     source.length = pdfDataRangeTransport.length;
     source.initialData = pdfDataRangeTransport.initialData;
   }
 
   return worker.messageHandler.sendWithPromise('GetDocRequest', {
     docId,
-    apiVersion: '2.2.51',
+    apiVersion: '2.2.67',
     source: {
       data: source.data,
       url: source.url,
       password: source.password,
       disableAutoFetch: source.disableAutoFetch,
       rangeChunkSize: source.rangeChunkSize,
       length: source.length
     },
@@ -1350,17 +1345,17 @@ const PDFDocumentLoadingTask = function 
           this._worker.destroy();
 
           this._worker = null;
         }
       });
     }
 
     then(onFulfilled, onRejected) {
-      (0, _util.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.');
+      (0, _display_utils.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.');
       return this.promise.then.apply(this.promise, arguments);
     }
 
   }
 
   return PDFDocumentLoadingTask;
 }();
 
@@ -2562,21 +2557,21 @@ class WorkerTransport {
         });
       }
     }, this);
     messageHandler.on('PageError', function (data) {
       if (this.destroyed) {
         return;
       }
 
-      const page = this.pageCache[data.pageNum - 1];
+      const page = this.pageCache[data.pageIndex];
       const intentState = page.intentStates[data.intent];
 
       if (intentState.displayReadyCapability) {
-        intentState.displayReadyCapability.reject(data.error);
+        intentState.displayReadyCapability.reject(new Error(data.error));
       } else {
         throw new Error(data.error);
       }
 
       if (intentState.operatorList) {
         intentState.operatorList.lastChunk = true;
 
         for (let i = 0; i < intentState.renderTasks.length; i++) {
@@ -2861,17 +2856,17 @@ class RenderTask {
     return this._internalRenderTask.capability.promise;
   }
 
   cancel() {
     this._internalRenderTask.cancel();
   }
 
   then(onFulfilled, onRejected) {
-    (0, _util.deprecated)('RenderTask.then method, use the `promise` getter instead.');
+    (0, _display_utils.deprecated)('RenderTask.then method, use the `promise` getter instead.');
     return this.promise.then.apply(this.promise, arguments);
   }
 
 }
 
 const InternalRenderTask = function InternalRenderTaskClosure() {
   const canvasInRendering = new WeakSet();
 
@@ -3033,19 +3028,19 @@ const InternalRenderTask = function Inte
       }
     }
 
   }
 
   return InternalRenderTask;
 }();
 
-const version = '2.2.51';
+const version = '2.2.67';
 exports.version = version;
-const build = 'c43396c2';
+const build = 'd587abbc';
 exports.build = build;
 
 /***/ }),
 /* 7 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
@@ -3053,56 +3048,57 @@ exports.build = build;
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
 exports.addLinkAttributes = addLinkAttributes;
 exports.getFilenameFromUrl = getFilenameFromUrl;
 exports.isFetchSupported = isFetchSupported;
 exports.isValidFetchUrl = isValidFetchUrl;
 exports.loadScript = loadScript;
+exports.deprecated = deprecated;
 exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;
 
 var _util = __w_pdfjs_require__(1);
 
 const DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
 exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
 const SVG_NS = 'http://www.w3.org/2000/svg';
 
 class DOMCanvasFactory {
   create(width, height) {
     if (width <= 0 || height <= 0) {
-      throw new Error('invalid canvas size');
-    }
-
-    let canvas = document.createElement('canvas');
-    let context = canvas.getContext('2d');
+      throw new Error('Invalid canvas size');
+    }
+
+    const canvas = document.createElement('canvas');
+    const context = canvas.getContext('2d');
     canvas.width = width;
     canvas.height = height;
     return {
       canvas,
       context
     };
   }
 
   reset(canvasAndContext, width, height) {
     if (!canvasAndContext.canvas) {
-      throw new Error('canvas is not specified');
+      throw new Error('Canvas is not specified');
     }
 
     if (width <= 0 || height <= 0) {
-      throw new Error('invalid canvas size');
+      throw new Error('Invalid canvas size');
     }
 
     canvasAndContext.canvas.width = width;
     canvasAndContext.canvas.height = height;
   }
 
   destroy(canvasAndContext) {
     if (!canvasAndContext.canvas) {
-      throw new Error('canvas is not specified');
+      throw new Error('Canvas is not specified');
     }
 
     canvasAndContext.canvas.width = 0;
     canvasAndContext.canvas.height = 0;
     canvasAndContext.canvas = null;
     canvasAndContext.context = null;
   }
 
@@ -3156,17 +3152,17 @@ class DOMCMapReaderFactory {
 
 }
 
 exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
 
 class DOMSVGFactory {
   create(width, height) {
     (0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions');
-    let svg = document.createElementNS(SVG_NS, 'svg:svg');
+    const svg = document.createElementNS(SVG_NS, 'svg:svg');
     svg.setAttribute('version', '1.1');
     svg.setAttribute('width', width + 'px');
     svg.setAttribute('height', height + 'px');
     svg.setAttribute('preserveAspectRatio', 'none');
     svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
     return svg;
   }
 
@@ -3188,18 +3184,18 @@ class PageViewport {
     offsetY = 0,
     dontFlip = false
   }) {
     this.viewBox = viewBox;
     this.scale = scale;
     this.rotation = rotation;
     this.offsetX = offsetX;
     this.offsetY = offsetY;
-    let centerX = (viewBox[2] + viewBox[0]) / 2;
-    let centerY = (viewBox[3] + viewBox[1]) / 2;
+    const centerX = (viewBox[2] + viewBox[0]) / 2;
+    const centerY = (viewBox[3] + viewBox[1]) / 2;
     let rotateA, rotateB, rotateC, rotateD;
     rotation = rotation % 360;
     rotation = rotation < 0 ? rotation + 360 : rotation;
 
     switch (rotation) {
       case 180:
         rotateA = -1;
         rotateB = 0;
@@ -3269,32 +3265,32 @@ class PageViewport {
     });
   }
 
   convertToViewportPoint(x, y) {
     return _util.Util.applyTransform([x, y], this.transform);
   }
 
   convertToViewportRectangle(rect) {
-    let tl = _util.Util.applyTransform([rect[0], rect[1]], this.transform);
-
-    let br = _util.Util.applyTransform([rect[2], rect[3]], this.transform);
-
-    return [tl[0], tl[1], br[0], br[1]];
+    const topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform);
+
+    const bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform);
+
+    return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
   }
 
   convertToPdfPoint(x, y) {
     return _util.Util.applyInverseTransform([x, y], this.transform);
   }
 
 }
 
 exports.PageViewport = PageViewport;
 
-var RenderingCancelledException = function RenderingCancelledException() {
+const RenderingCancelledException = function RenderingCancelledException() {
   function RenderingCancelledException(msg, type) {
     this.message = msg;
     this.type = type;
   }
 
   RenderingCancelledException.prototype = new Error();
   RenderingCancelledException.prototype.name = 'RenderingCancelledException';
   RenderingCancelledException.constructor = RenderingCancelledException;
@@ -3316,26 +3312,26 @@ function addLinkAttributes(link, {
   url,
   target,
   rel
 } = {}) {
   link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : '';
 
   if (url) {
     const LinkTargetValues = Object.values(LinkTarget);
-    let targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE;
+    const targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE;
     link.target = LinkTargetStringMap[targetIndex];
     link.rel = typeof rel === 'string' ? rel : DEFAULT_LINK_REL;
   }
 }
 
 function getFilenameFromUrl(url) {
-  var anchor = url.indexOf('#');
-  var query = url.indexOf('?');
-  var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);
+  const anchor = url.indexOf('#');
+  const query = url.indexOf('?');
+  const end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);
   return url.substring(url.lastIndexOf('/', end) + 1, end);
 }
 
 class StatTimer {
   constructor(enable = true) {
     this.enabled = !!enable;
     this.started = Object.create(null);
     this.times = [];
@@ -3366,32 +3362,30 @@ class StatTimer {
       'name': name,
       'start': this.started[name],
       'end': Date.now()
     });
     delete this.started[name];
   }
 
   toString() {
-    let times = this.times;
     let out = '',
         longest = 0;
 
-    for (let i = 0, ii = times.length; i < ii; ++i) {
-      let name = times[i]['name'];
+    for (const time of this.times) {
+      const name = time.name;
 
       if (name.length > longest) {
         longest = name.length;
       }
     }
 
-    for (let i = 0, ii = times.length; i < ii; ++i) {
-      let span = times[i];
-      let duration = span.end - span.start;
-      out += `${span['name'].padEnd(longest)} ${duration}ms\n`;
+    for (const time of this.times) {
+      const duration = time.end - time.start;
+      out += `${time.name.padEnd(longest)} ${duration}ms\n`;
     }
 
     return out;
   }
 
 }
 
 exports.StatTimer = StatTimer;
@@ -3425,28 +3419,32 @@ function isValidFetchUrl(url, baseUrl) {
     return protocol === 'http:' || protocol === 'https:';
   } catch (ex) {
     return false;
   }
 }
 
 function loadScript(src) {
   return new Promise((resolve, reject) => {
-    let script = document.createElement('script');
+    const script = document.createElement('script');
     script.src = src;
     script.onload = resolve;
 
     script.onerror = function () {
       reject(new Error(`Cannot load script at: ${script.src}`));
     };
 
     (document.head || document.documentElement).appendChild(script);
   });
 }
 
+function deprecated(details) {
+  console.log('Deprecated API usage: ' + details);
+}
+
 /***/ }),
 /* 8 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
 Object.defineProperty(exports, "__esModule", {
--- 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.51';
-const pdfjsBuild = 'c43396c2';
+const pdfjsVersion = '2.2.67';
+const pdfjsBuild = 'd587abbc';
 
 const pdfjsCoreWorker = __w_pdfjs_require__(1);
 
 exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
@@ -141,19 +141,19 @@ Object.defineProperty(exports, "__esModu
   value: true
 });
 exports.WorkerMessageHandler = exports.WorkerTask = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
 var _pdf_manager = __w_pdfjs_require__(7);
 
-var _is_node = _interopRequireDefault(__w_pdfjs_require__(46));
-
-var _message_handler = __w_pdfjs_require__(47);
+var _is_node = _interopRequireDefault(__w_pdfjs_require__(47));
+
+var _message_handler = __w_pdfjs_require__(48);
 
 var _primitives = __w_pdfjs_require__(12);
 
 var _core_utils = __w_pdfjs_require__(9);
 
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
 var WorkerTask = function WorkerTaskClosure() {
@@ -371,18 +371,19 @@ var WorkerMessageHandler = {
     });
   },
 
   createDocumentHandler(docParams, port) {
     var pdfManager;
     var terminated = false;
     var cancelXHRs = null;
     var WorkerTasks = [];
+    const verbosity = (0, _util.getVerbosityLevel)();
     let apiVersion = docParams.apiVersion;
-    let workerVersion = '2.2.51';
+    let workerVersion = '2.2.67';
 
     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';
@@ -681,26 +682,28 @@ var WorkerMessageHandler = {
         return page.getAnnotationsData(intent);
       });
     });
     handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
       var pageIndex = data.pageIndex;
       pdfManager.getPage(pageIndex).then(function (page) {
         var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
         startWorkerTask(task);
-        var pageNum = pageIndex + 1;
-        var start = Date.now();
+        const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
         page.getOperatorList({
           handler,
           task,
           intent: data.intent,
           renderInteractiveForms: data.renderInteractiveForms
         }).then(function (operatorList) {
           finishWorkerTask(task);
-          (0, _util.info)('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
+
+          if (start) {
+            (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorList.totalLength}`);
+          }
         }, function (e) {
           finishWorkerTask(task);
 
           if (task.terminated) {
             return;
           }
 
           handler.send('UnsupportedFeature', {
@@ -722,44 +725,47 @@ var WorkerMessageHandler = {
           } else {
             wrappedException = {
               message: 'Unknown exception type: ' + typeof e,
               stack: minimumStackMessage
             };
           }
 
           handler.send('PageError', {
-            pageNum,
+            pageIndex,
             error: wrappedException,
             intent: data.intent
           });
         });
       });
     }, this);
     handler.on('GetTextContent', function wphExtractText(data, sink) {
       var pageIndex = data.pageIndex;
 
       sink.onPull = function (desiredSize) {};
 
       sink.onCancel = function (reason) {};
 
       pdfManager.getPage(pageIndex).then(function (page) {
         var task = new WorkerTask('GetTextContent: page ' + pageIndex);
         startWorkerTask(task);
-        var pageNum = pageIndex + 1;
-        var start = Date.now();
+        const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
         page.extractTextContent({
           handler,
           task,
           sink,
           normalizeWhitespace: data.normalizeWhitespace,
           combineTextItems: data.combineTextItems
         }).then(function () {
           finishWorkerTask(task);
-          (0, _util.info)('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
+
+          if (start) {
+            (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
+          }
+
           sink.close();
         }, function (reason) {
           finishWorkerTask(task);
 
           if (task.terminated) {
             return;
           }
 
@@ -830,17 +836,16 @@ if (typeof window === 'undefined' && !(0
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
 exports.arrayByteLength = arrayByteLength;
 exports.arraysToBytes = arraysToBytes;
 exports.assert = assert;
 exports.bytesToString = bytesToString;
 exports.createPromiseCapability = createPromiseCapability;
-exports.deprecated = deprecated;
 exports.getVerbosityLevel = getVerbosityLevel;
 exports.info = info;
 exports.isArrayBuffer = isArrayBuffer;
 exports.isBool = isBool;
 exports.isEmptyObj = isEmptyObj;
 exports.isNum = isNum;
 exports.isString = isString;
 exports.isSpace = isSpace;
@@ -1160,20 +1165,16 @@ function info(msg) {
 }
 
 function warn(msg) {
   if (verbosity >= VerbosityLevel.WARNINGS) {
     console.log('Warning: ' + msg);
   }
 }
 
-function deprecated(details) {
-  console.log('Deprecated API usage: ' + details);
-}
-
 function unreachable(msg) {
   throw new Error(msg);
 }
 
 function assert(cond, msg) {
   if (!cond) {
     unreachable(msg);
   }
@@ -5988,41 +5989,52 @@ var Parser = function ParserClosure() {
         (0, _util.warn)('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
         stream.skip(-length);
         return this.findDefaultInlineStreamEnd(stream);
       }
 
       this.inlineStreamSkipEI(stream);
       return length;
     },
-    findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
+
+    findASCII85DecodeInlineStreamEnd(stream) {
       var TILDE = 0x7E,
           GT = 0x3E;
       var startPos = stream.pos,
           ch,
           length;
 
       while ((ch = stream.getByte()) !== -1) {
-        if (ch === TILDE && stream.peekByte() === GT) {
-          stream.skip();
-          break;
+        if (ch === TILDE) {
+          ch = stream.peekByte();
+
+          while ((0, _util.isSpace)(ch)) {
+            stream.skip();
+            ch = stream.peekByte();
+          }
+
+          if (ch === GT) {
+            stream.skip();
+            break;
+          }
         }
       }
 
       length = stream.pos - startPos;
 
       if (ch === -1) {
         (0, _util.warn)('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
         stream.skip(-length);
         return this.findDefaultInlineStreamEnd(stream);
       }
 
       this.inlineStreamSkipEI(stream);
       return length;
     },
+
     findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
       var GT = 0x3E;
       var startPos = stream.pos,
           ch,
           length;
 
       while ((ch = stream.getByte()) !== -1) {
         if (ch === GT) {
@@ -19534,18 +19546,16 @@ Object.defineProperty(exports, "__esModu
   value: true
 });
 exports.PartialEvaluator = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
 var _cmap = __w_pdfjs_require__(29);
 
-var _stream = __w_pdfjs_require__(14);
-
 var _primitives = __w_pdfjs_require__(12);
 
 var _fonts = __w_pdfjs_require__(30);
 
 var _encodings = __w_pdfjs_require__(33);
 
 var _unicode = __w_pdfjs_require__(36);
 
@@ -19554,101 +19564,46 @@ var _standard_fonts = __w_pdfjs_require_
 var _pattern = __w_pdfjs_require__(39);
 
 var _parser = __w_pdfjs_require__(13);
 
 var _bidi = __w_pdfjs_require__(40);
 
 var _colorspace = __w_pdfjs_require__(25);
 
+var _stream = __w_pdfjs_require__(14);
+
 var _glyphlist = __w_pdfjs_require__(34);
 
 var _core_utils = __w_pdfjs_require__(9);
 
 var _metrics = __w_pdfjs_require__(41);
 
 var _function = __w_pdfjs_require__(42);
 
 var _jpeg_stream = __w_pdfjs_require__(20);
 
 var _murmurhash = __w_pdfjs_require__(44);
 
+var _image_utils = __w_pdfjs_require__(45);
+
 var _operator_list = __w_pdfjs_require__(27);
 
-var _image = __w_pdfjs_require__(45);
+var _image = __w_pdfjs_require__(46);
 
 var PartialEvaluator = function PartialEvaluatorClosure() {
   const DefaultPartialEvaluatorOptions = {
     forceDataSchema: false,
     maxImageSize: -1,
     disableFontFace: false,
     nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE,
     ignoreErrors: false,
     isEvalSupported: true
   };
 
-  function NativeImageDecoder({
-    xref,
-    resources,
-    handler,
-    forceDataSchema = false,
-    pdfFunctionFactory
-  }) {
-    this.xref = xref;
-    this.resources = resources;
-    this.handler = handler;
-    this.forceDataSchema = forceDataSchema;
-    this.pdfFunctionFactory = pdfFunctionFactory;
-  }
-
-  NativeImageDecoder.prototype = {
-    canDecode(image) {
-      return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory);
-    },
-
-    decode(image) {
-      var dict = image.dict;
-      var colorSpace = dict.get('ColorSpace', 'CS');
-      colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory);
-      return this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function ({
-        data,
-        width,
-        height
-      }) {
-        return new _stream.Stream(data, 0, data.length, image.dict);
-      });
-    }
-
-  };
-
-  NativeImageDecoder.isSupported = function (image, xref, res, pdfFunctionFactory) {
-    var dict = image.dict;
-
-    if (dict.has('DecodeParms') || dict.has('DP')) {
-      return false;
-    }
-
-    var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory);
-
-    return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
-  };
-
-  NativeImageDecoder.isDecodable = function (image, xref, res, pdfFunctionFactory) {
-    var dict = image.dict;
-
-    if (dict.has('DecodeParms') || dict.has('DP')) {
-      return false;
-    }
-
-    var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory);
-
-    const bpc = dict.get('BitsPerComponent', 'BPC') || 1;
-    return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'), bpc);
-  };
-
   function PartialEvaluator({
     pdfManager,
     xref,
     handler,
     pageIndex,
     idFactory,
     fontCache,
     builtInCMapCache,
@@ -19980,17 +19935,17 @@ var PartialEvaluator = function PartialE
         imgData = imageObj.createImageData(true);
         operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
         return Promise.resolve();
       }
 
       const nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport;
       var objId = 'img_' + this.idFactory.createObjId();
 
-      if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory)) {
+      if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && _image_utils.NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory)) {
         return this.handler.sendWithPromise('obj', [objId, this.pageIndex, 'JpegStream', image.getIR(this.options.forceDataSchema)]).then(function () {
           operatorList.addDependency(objId);
           args = [objId, w, h];
           operatorList.addOp(_util.OPS.paintJpegXObject, args);
 
           if (cacheKey) {
             imageCache[cacheKey] = {
               fn: _util.OPS.paintJpegXObject,
@@ -20009,17 +19964,17 @@ var PartialEvaluator = function PartialE
             forceDisableNativeImageDecoder: true
           });
         });
       }
 
       var nativeImageDecoder = null;
 
       if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) {
-        nativeImageDecoder = new NativeImageDecoder({
+        nativeImageDecoder = new _image_utils.NativeImageDecoder({
           xref: this.xref,
           resources,
           handler: this.handler,
           forceDataSchema: this.options.forceDataSchema,
           pdfFunctionFactory: this.pdfFunctionFactory
         });
       }
 
@@ -43455,149 +43410,217 @@ exports.PostScriptLexer = PostScriptLexe
 
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
 exports.MurmurHash3_64 = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
-var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
-  var MASK_HIGH = 0xffff0000;
-  var MASK_LOW = 0xffff;
-
-  function MurmurHash3_64(seed) {
-    var SEED = 0xc3d2e1f0;
+const SEED = 0xc3d2e1f0;
+const MASK_HIGH = 0xffff0000;
+const MASK_LOW = 0xffff;
+
+class MurmurHash3_64 {
+  constructor(seed) {
     this.h1 = seed ? seed & 0xffffffff : SEED;
     this.h2 = seed ? seed & 0xffffffff : SEED;
   }
 
-  MurmurHash3_64.prototype = {
-    update: function MurmurHash3_64_update(input) {
-      let data, length;
-
-      if ((0, _util.isString)(input)) {
-        data = new Uint8Array(input.length * 2);
-        length = 0;
-
-        for (let i = 0, ii = input.length; i < ii; i++) {
-          var code = input.charCodeAt(i);
-
-          if (code <= 0xff) {
-            data[length++] = code;
-          } else {
-            data[length++] = code >>> 8;
-            data[length++] = code & 0xff;
-          }
-        }
-      } else if ((0, _util.isArrayBuffer)(input)) {
-        data = input;
-        length = data.byteLength;
-      } else {
-        throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
-      }
-
-      var blockCounts = length >> 2;
-      var tailLength = length - blockCounts * 4;
-      var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
-      var k1 = 0;
-      var k2 = 0;
-      var h1 = this.h1;
-      var h2 = this.h2;
-      var C1 = 0xcc9e2d51;
-      var C2 = 0x1b873593;
-      var C1_LOW = C1 & MASK_LOW;
-      var C2_LOW = C2 & MASK_LOW;
-
-      for (let i = 0; i < blockCounts; i++) {
-        if (i & 1) {
-          k1 = dataUint32[i];
-          k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
-          k1 = k1 << 15 | k1 >>> 17;
-          k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+  update(input) {
+    let data, length;
+
+    if ((0, _util.isString)(input)) {
+      data = new Uint8Array(input.length * 2);
+      length = 0;
+
+      for (let i = 0, ii = input.length; i < ii; i++) {
+        const code = input.charCodeAt(i);
+
+        if (code <= 0xff) {
+          data[length++] = code;
+        } else {
+          data[length++] = code >>> 8;
+          data[length++] = code & 0xff;
+        }
+      }
+    } else if ((0, _util.isArrayBuffer)(input)) {
+      data = input;
+      length = data.byteLength;
+    } else {
+      throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
+    }
+
+    const blockCounts = length >> 2;
+    const tailLength = length - blockCounts * 4;
+    const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
+    let k1 = 0,
+        k2 = 0;
+    let h1 = this.h1,
+        h2 = this.h2;
+    const C1 = 0xcc9e2d51,
+          C2 = 0x1b873593;
+    const C1_LOW = C1 & MASK_LOW,
+          C2_LOW = C2 & MASK_LOW;
+
+    for (let i = 0; i < blockCounts; i++) {
+      if (i & 1) {
+        k1 = dataUint32[i];
+        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
+        k1 = k1 << 15 | k1 >>> 17;
+        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+        h1 ^= k1;
+        h1 = h1 << 13 | h1 >>> 19;
+        h1 = h1 * 5 + 0xe6546b64;
+      } else {
+        k2 = dataUint32[i];
+        k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
+        k2 = k2 << 15 | k2 >>> 17;
+        k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
+        h2 ^= k2;
+        h2 = h2 << 13 | h2 >>> 19;
+        h2 = h2 * 5 + 0xe6546b64;
+      }
+    }
+
+    k1 = 0;
+
+    switch (tailLength) {
+      case 3:
+        k1 ^= data[blockCounts * 4 + 2] << 16;
+
+      case 2:
+        k1 ^= data[blockCounts * 4 + 1] << 8;
+
+      case 1:
+        k1 ^= data[blockCounts * 4];
+        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
+        k1 = k1 << 15 | k1 >>> 17;
+        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+
+        if (blockCounts & 1) {
           h1 ^= k1;
-          h1 = h1 << 13 | h1 >>> 19;
-          h1 = h1 * 5 + 0xe6546b64;
-        } else {
-          k2 = dataUint32[i];
-          k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
-          k2 = k2 << 15 | k2 >>> 17;
-          k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
-          h2 ^= k2;
-          h2 = h2 << 13 | h2 >>> 19;
-          h2 = h2 * 5 + 0xe6546b64;
-        }
-      }
-
-      k1 = 0;
-
-      switch (tailLength) {
-        case 3:
-          k1 ^= data[blockCounts * 4 + 2] << 16;
-
-        case 2:
-          k1 ^= data[blockCounts * 4 + 1] << 8;
-
-        case 1:
-          k1 ^= data[blockCounts * 4];
-          k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
-          k1 = k1 << 15 | k1 >>> 17;
-          k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
-
-          if (blockCounts & 1) {
-            h1 ^= k1;
-          } else {
-            h2 ^= k1;
-          }
-
-      }
-
-      this.h1 = h1;
-      this.h2 = h2;
-      return this;
-    },
-    hexdigest: function MurmurHash3_64_hexdigest() {
-      var h1 = this.h1;
-      var h2 = this.h2;
-      h1 ^= h2 >>> 1;
-      h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
-      h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
-      h1 ^= h2 >>> 1;
-      h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
-      h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
-      h1 ^= h2 >>> 1;
-
-      for (var i = 0, arr = [h1, h2], str = ''; i < arr.length; i++) {
-        var hex = (arr[i] >>> 0).toString(16);
-
-        while (hex.length < 8) {
-          hex = '0' + hex;
-        }
-
-        str += hex;
-      }
-
-      return str;
-    }
-  };
-  return MurmurHash3_64;
-}();
+        } else {
+          h2 ^= k1;
+        }
+
+    }
+
+    this.h1 = h1;
+    this.h2 = h2;
+  }
+
+  hexdigest() {
+    let h1 = this.h1,
+        h2 = this.h2;
+    h1 ^= h2 >>> 1;
+    h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
+    h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
+    h1 ^= h2 >>> 1;
+    h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
+    h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
+    h1 ^= h2 >>> 1;
+    const hex1 = (h1 >>> 0).toString(16),
+          hex2 = (h2 >>> 0).toString(16);
+    return hex1.padStart(8, '0') + hex2.padStart(8, '0');
+  }
+
+}
 
 exports.MurmurHash3_64 = MurmurHash3_64;
 
 /***/ }),
 /* 45 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
+exports.NativeImageDecoder = void 0;
+
+var _colorspace = __w_pdfjs_require__(25);
+
+var _jpeg_stream = __w_pdfjs_require__(20);
+
+var _stream = __w_pdfjs_require__(14);
+
+class NativeImageDecoder {
+  constructor({
+    xref,
+    resources,
+    handler,
+    forceDataSchema = false,
+    pdfFunctionFactory
+  }) {
+    this.xref = xref;
+    this.resources = resources;
+    this.handler = handler;
+    this.forceDataSchema = forceDataSchema;
+    this.pdfFunctionFactory = pdfFunctionFactory;
+  }
+
+  canDecode(image) {
+    return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory);
+  }
+
+  decode(image) {
+    const dict = image.dict;
+    let colorSpace = dict.get('ColorSpace', 'CS');
+    colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory);
+    return this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function ({
+      data,
+      width,
+      height
+    }) {
+      return new _stream.Stream(data, 0, data.length, dict);
+    });
+  }
+
+  static isSupported(image, xref, res, pdfFunctionFactory) {
+    const dict = image.dict;
+
+    if (dict.has('DecodeParms') || dict.has('DP')) {
+      return false;
+    }
+
+    const cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory);
+
+    return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
+  }
+
+  static isDecodable(image, xref, res, pdfFunctionFactory) {
+    const dict = image.dict;
+
+    if (dict.has('DecodeParms') || dict.has('DP')) {
+      return false;
+    }
+
+    const cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory);
+
+    const bpc = dict.get('BitsPerComponent', 'BPC') || 1;
+    return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'), bpc);
+  }
+
+}
+
+exports.NativeImageDecoder = NativeImageDecoder;
+
+/***/ }),
+/* 46 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
 exports.PDFImage = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
 var _primitives = __w_pdfjs_require__(12);
 
 var _colorspace = __w_pdfjs_require__(25);
 
@@ -44239,28 +44262,28 @@ var PDFImage = function PDFImageClosure(
 
   };
   return PDFImage;
 }();
 
 exports.PDFImage = PDFImage;
 
 /***/ }),
-/* 46 */
+/* 47 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
 module.exports = function isNodeJS() {
   return typeof process === 'object' && process + '' === '[object process]' && !process.versions['nw'];
 };
 
 /***/ }),
-/* 47 */
+/* 48 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
--- a/browser/extensions/pdfjs/content/web/viewer.js
+++ b/browser/extensions/pdfjs/content/web/viewer.js
@@ -427,17 +427,19 @@ let PDFViewerApplication = {
     }
 
     try {
       const prefs = await this.preferences.getAll();
 
       for (const name in prefs) {
         _app_options.AppOptions.set(name, prefs[name]);
       }
-    } catch (reason) {}
+    } catch (reason) {
+      console.error(`_readPreferences: "${reason.message}".`);
+    }
   },
 
   async _parseHashParameters() {
     if (!_app_options.AppOptions.get('pdfBugEnabled')) {
       return;
     }
 
     const waitOn = [];
@@ -3296,19 +3298,26 @@ class AppOptions {
     for (const name in defaultOptions) {
       const defaultOption = defaultOptions[name];
 
       if (kind) {
         if ((kind & defaultOption.kind) === 0) {
           continue;
         }
 
-        if ((kind & OptionKind.PREFERENCE) !== 0) {
-          options[name] = defaultOption.value;
-          continue;
+        if (kind === OptionKind.PREFERENCE) {
+          const value = defaultOption.value,
+                valueType = typeof value;
+
+          if (valueType === 'boolean' || valueType === 'string' || valueType === 'number' && Number.isInteger(value)) {
+            options[name] = value;
+            continue;
+          }
+
+          throw new Error(`Invalid type for preference: ${name}`);
         }
       }
 
       const userOption = userOptions[name];
       options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value;
     }
 
     return options;
--- 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.51
+  release: version 2.2.67
 
   # 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
--- a/dom/file/ipc/IPCBlobInputStreamThread.cpp
+++ b/dom/file/ipc/IPCBlobInputStreamThread.cpp
@@ -82,16 +82,27 @@ bool IPCBlobInputStreamThread::IsOnFileE
     nsIEventTarget* aEventTarget) {
   MOZ_ASSERT(aEventTarget);
 
   mozilla::StaticMutexAutoLock lock(gIPCBlobThreadMutex);
   return gIPCBlobThread && aEventTarget == gIPCBlobThread->mThread;
 }
 
 /* static */
+IPCBlobInputStreamThread* IPCBlobInputStreamThread::Get() {
+  mozilla::StaticMutexAutoLock lock(gIPCBlobThreadMutex);
+
+  if (gShutdownHasStarted) {
+    return nullptr;
+  }
+
+  return gIPCBlobThread;
+}
+
+/* static */
 IPCBlobInputStreamThread* IPCBlobInputStreamThread::GetOrCreate() {
   mozilla::StaticMutexAutoLock lock(gIPCBlobThreadMutex);
 
   if (gShutdownHasStarted) {
     return nullptr;
   }
 
   if (!gIPCBlobThread) {
--- a/dom/file/ipc/IPCBlobInputStreamThread.h
+++ b/dom/file/ipc/IPCBlobInputStreamThread.h
@@ -22,16 +22,18 @@ class IPCBlobInputStreamThread final : p
                                        public nsIEventTarget {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOBSERVER
   NS_DECL_NSIEVENTTARGET
 
   static bool IsOnFileEventTarget(nsIEventTarget* aEventTarget);
 
+  static IPCBlobInputStreamThread* Get();
+
   static IPCBlobInputStreamThread* GetOrCreate();
 
   void MigrateActor(IPCBlobInputStreamChild* aActor);
 
   bool Initialize();
 
   void InitializeOnMainThread();
 
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1183,16 +1183,18 @@ void ContentChild::InitXPCOM(
   BackgroundChild::Startup();
 
   PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
   if (NS_WARN_IF(!actorChild)) {
     MOZ_ASSERT_UNREACHABLE("PBackground init can't fail at this point");
     return;
   }
 
+  LSObject::Initialize();
+
   ClientManager::Startup();
 
   RemoteWorkerService::Initialize();
 
   nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
   if (!svc) {
     NS_WARNING("Couldn't acquire console service");
     return;
--- a/dom/localstorage/LSObject.cpp
+++ b/dom/localstorage/LSObject.cpp
@@ -191,16 +191,44 @@ LSObject::LSObject(nsPIDOMWindowInner* a
 
 LSObject::~LSObject() {
   AssertIsOnOwningThread();
 
   DropObserver();
 }
 
 // static
+void LSObject::Initialize() {
+  MOZ_ASSERT(NS_IsMainThread());
+
+  nsCOMPtr<nsIEventTarget> domFileThread =
+      IPCBlobInputStreamThread::GetOrCreate();
+  if (NS_WARN_IF(!domFileThread)) {
+    return;
+  }
+
+  RefPtr<Runnable> runnable =
+      NS_NewRunnableFunction("LSObject::Initialize", []() {
+        AssertIsOnDOMFileThread();
+
+        PBackgroundChild* backgroundActor =
+            BackgroundChild::GetOrCreateForCurrentThread();
+
+        if (NS_WARN_IF(!backgroundActor)) {
+          return;
+        }
+      });
+
+  if (NS_WARN_IF(NS_FAILED(domFileThread->Dispatch(runnable,
+                                                   NS_DISPATCH_NORMAL)))) {
+    return;
+  }
+}
+
+// static
 nsresult LSObject::CreateForWindow(nsPIDOMWindowInner* aWindow,
                                    Storage** aStorage) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aStorage);
   MOZ_ASSERT(NextGenLocalStorageEnabled());
   MOZ_ASSERT(nsContentUtils::StorageAllowedForWindow(aWindow) >
              nsContentUtils::StorageAccess::eDeny);
@@ -386,18 +414,19 @@ void LSObject::OnSyncMessageHandled() {
   gPendingSyncMessage = false;
 }
 
 LSRequestChild* LSObject::StartRequest(nsIEventTarget* aMainEventTarget,
                                        const LSRequestParams& aParams,
                                        LSRequestChildCallback* aCallback) {
   AssertIsOnDOMFileThread();
 
-  PBackgroundChild* backgroundActor =
-      BackgroundChild::GetOrCreateForCurrentThread(aMainEventTarget);
+  PBackgroundChild* backgroundActor = XRE_IsParentProcess() ?
+      BackgroundChild::GetOrCreateForCurrentThread(aMainEventTarget) :
+      BackgroundChild::GetForCurrentThread();
   if (NS_WARN_IF(!backgroundActor)) {
     return nullptr;
   }
 
   LSRequestChild* actor = new LSRequestChild(aCallback);
 
   backgroundActor->SendPBackgroundLSRequestConstructor(actor, aParams);
 
@@ -1013,18 +1042,19 @@ nsresult RequestHelper::StartAndReturnRe
 
     const nsLocalExecutionGuard localExecution(thread->EnterLocalExecution());
     mNestedEventTarget = localExecution.GetEventTarget();
     MOZ_ASSERT(mNestedEventTarget);
 
     mNestedEventTargetWrapper =
         new NestedEventTargetWrapper(mNestedEventTarget);
 
-    nsCOMPtr<nsIEventTarget> domFileThread =
-        IPCBlobInputStreamThread::GetOrCreate();
+    nsCOMPtr<nsIEventTarget> domFileThread = XRE_IsParentProcess() ?
+        IPCBlobInputStreamThread::GetOrCreate() :
+        IPCBlobInputStreamThread::Get();
     if (NS_WARN_IF(!domFileThread)) {
       return NS_ERROR_FAILURE;
     }
 
     nsresult rv;
 
     {
       {
--- a/dom/localstorage/LSObject.h
+++ b/dom/localstorage/LSObject.h
@@ -69,16 +69,18 @@ class LSObject final : public Storage {
   Maybe<nsID> mClientId;
   nsCString mOrigin;
   nsCString mOriginKey;
   nsString mDocumentURI;
 
   bool mInExplicitSnapshot;
 
  public:
+  static void Initialize();
+
   /**
    * The normal creation path invoked by nsGlobalWindowInner.
    */
   static nsresult CreateForWindow(nsPIDOMWindowInner* aWindow,
                                   Storage** aStorage);
 
   /**
    * nsIDOMStorageManager creation path for use in testing logic.  Supports the
--- a/toolkit/content/aboutProfiles.js
+++ b/toolkit/content/aboutProfiles.js
@@ -326,31 +326,10 @@ function restart(safeMode) {
   if (safeMode) {
     Services.startup.restartInSafeMode(flags);
   } else {
     Services.startup.quit(flags);
   }
 }
 
 window.addEventListener("DOMContentLoaded", function() {
-  // Check if any profiles are missing on the disk and if so remove them.
-  // We cannot remove profiles while iterating the list returned from the
-  // profile service, so convert it to a new array first.
-  try {
-    let changed = false;
-    for (let profile of [...ProfileService.profiles]) {
-      if (!profile.rootDir.exists() || !profile.rootDir.isDirectory()) {
-        profile.remove(false);
-        changed = true;
-      }
-    }
-
-    if (changed) {
-      ProfileService.flush();
-    }
-  } catch (e) {
-    // There shouldn't be any failures to catch here, but just in case let the
-    // UI build itself properly.
-    Cu.reportError(e);
-  }
-
   refreshUI();
 }, {once: true});
--- a/toolkit/profile/content/profileSelection.js
+++ b/toolkit/profile/content/profileSelection.js
@@ -19,33 +19,16 @@ var gProfileService;
 
 function startup() {
   try {
     gDialogParams = window.arguments[0].
       QueryInterface(I.nsIDialogParamBlock);
 
     gProfileService = C[ToolkitProfileService].getService(I.nsIToolkitProfileService);
 
-    // Check if any profiles are missing on the disk and if so remove them.
-    // We cannot remove profiles while iterating the list returned from the
-    // profile service, so convert it to a new array first.
-    try {
-      for (let profile of [...gProfileService.profiles]) {
-        if (!profile.rootDir.exists() || !profile.rootDir.isDirectory()) {
-          profile.remove(false);
-        }
-      }
-
-      // The profile service is always flushed after this dialog completes.
-    } catch (e) {
-      // There shouldn't be any failures to catch here, but just in case let the
-      // UI build itself properly.
-      Cu.reportError(e);
-    }
-
     gProfileManagerBundle = document.getElementById("bundle_profileManager");
     gBrandBundle = document.getElementById("bundle_brand");
 
     document.documentElement.centerWindowOnScreen();
 
     var profilesElement = document.getElementById("profiles");
 
     for (let profile of gProfileService.profiles.entries(I.nsIToolkitProfile)) {