tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1579159-m.tailieu.vn-pdfjs-worker-disable.js (956B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * m.tailieu.vn - Override PDFJS.disableWorker to be true
      9 * WebCompat issue #39057 - https://webcompat.com/issues/39057
     10 *
     11 * Custom viewer built with PDF.js is not working in Firefox for Android
     12 * Disabling worker to match Chrome behavior fixes the issue
     13 */
     14 
     15 /* globals exportFunction */
     16 
     17 console.info(
     18  "window.PDFJS.disableWorker has been set to true for compatibility reasons. See https://webcompat.com/issues/39057 for details."
     19 );
     20 
     21 let globals = {};
     22 
     23 Object.defineProperty(window.wrappedJSObject, "PDFJS", {
     24  configurable: true,
     25 
     26  get: exportFunction(function () {
     27    return globals;
     28  }, window),
     29 
     30  set: exportFunction(function (value = {}) {
     31    globals = value;
     32    globals.disableWorker = true;
     33  }, window),
     34 });