diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index a12e93bda..57d9c47c7 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -18,10 +18,16 @@ // Skip compatibility checks for the extensions and if we already ran // this module. if ((typeof PDFJSDev === 'undefined' || - !PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) && + !PDFJSDev.test('FIREFOX || MOZCENTRAL')) && (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked)) { +// In the Chrome extension, most of the polyfills are unnecessary. +// We support down to Chrome 49, because it's still commonly used by Windows XP +// users - https://github.com/mozilla/pdf.js/issues/9397 +if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) { + var globalScope = require('./global_scope'); + const isNodeJS = require('./is_node'); var userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || ''; @@ -151,15 +157,6 @@ PDFJS.compatibilityChecked = true; }; })(); -// Provides support for Object.values in legacy browsers. -// Support: IE, Chrome<54 -(function checkObjectValues() { - if (Object.values) { - return; - } - Object.values = require('core-js/fn/object/values'); -})(); - // Provides support for Array.prototype.includes in legacy browsers. // Support: IE, Chrome<47 (function checkArrayIncludes() { @@ -865,4 +862,15 @@ PDFJS.compatibilityChecked = true; globalScope.URL = JURL; })(); +} // End of !PDFJSDev.test('CHROME') + +// Provides support for Object.values in legacy browsers. +// Support: IE, Chrome<54 +(function checkObjectValues() { + if (Object.values) { + return; + } + Object.values = require('core-js/fn/object/values'); +})(); + } diff --git a/src/shared/streams_polyfill.js b/src/shared/streams_polyfill.js index e35da6cd9..7c8e85d87 100644 --- a/src/shared/streams_polyfill.js +++ b/src/shared/streams_polyfill.js @@ -31,9 +31,6 @@ if (typeof ReadableStream !== 'undefined') { if (isReadableStreamSupported) { exports.ReadableStream = ReadableStream; } else { - if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) { - throw new Error('ReadableStream polyfill is not found for Chrome bundle'); - } exports.ReadableStream = require('../../external/streams/streams-lib').ReadableStream; }