Enable some polyfills for compat with Chrome 49
Successfully tested with Chrome 49.
This commit is contained in:
parent
44025a3ec1
commit
5d1c541702
@ -18,10 +18,16 @@
|
|||||||
// Skip compatibility checks for the extensions and if we already ran
|
// Skip compatibility checks for the extensions and if we already ran
|
||||||
// this module.
|
// this module.
|
||||||
if ((typeof PDFJSDev === 'undefined' ||
|
if ((typeof PDFJSDev === 'undefined' ||
|
||||||
!PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) &&
|
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) &&
|
||||||
(typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked)) {
|
(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');
|
var globalScope = require('./global_scope');
|
||||||
|
|
||||||
const isNodeJS = require('./is_node');
|
const isNodeJS = require('./is_node');
|
||||||
|
|
||||||
var userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || '';
|
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.
|
// Provides support for Array.prototype.includes in legacy browsers.
|
||||||
// Support: IE, Chrome<47
|
// Support: IE, Chrome<47
|
||||||
(function checkArrayIncludes() {
|
(function checkArrayIncludes() {
|
||||||
@ -865,4 +862,15 @@ PDFJS.compatibilityChecked = true;
|
|||||||
globalScope.URL = JURL;
|
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');
|
||||||
|
})();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,6 @@ if (typeof ReadableStream !== 'undefined') {
|
|||||||
if (isReadableStreamSupported) {
|
if (isReadableStreamSupported) {
|
||||||
exports.ReadableStream = ReadableStream;
|
exports.ReadableStream = ReadableStream;
|
||||||
} else {
|
} else {
|
||||||
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
|
|
||||||
throw new Error('ReadableStream polyfill is not found for Chrome bundle');
|
|
||||||
}
|
|
||||||
exports.ReadableStream =
|
exports.ReadableStream =
|
||||||
require('../../external/streams/streams-lib').ReadableStream;
|
require('../../external/streams/streams-lib').ReadableStream;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user