Enable some polyfills for compat with Chrome 49

Successfully tested with Chrome 49.
This commit is contained in:
Rob Wu 2018-01-26 12:18:57 +01:00
parent 44025a3ec1
commit 5d1c541702
2 changed files with 18 additions and 13 deletions

View File

@ -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');
})();
}

View File

@ -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;
}