Add Number.isNaN and Number.isInteger polyfills in compatibility.js, since the Streams polyfill relies on them

Without this, the Streams polyfill will fail in Internet Explorer when the code-paths containing these methods are used.
This commit is contained in:
Jonas Jenwald 2017-07-13 11:48:17 +02:00
parent 2cef24a2ad
commit f2270252c7

View File

@ -836,6 +836,29 @@ PDFJS.compatibilityChecked = true;
}; };
})(); })();
// Provides support for Number.isNaN in legacy browsers.
// Support: IE.
(function checkNumberIsNaN() {
if (Number.isNaN) {
return;
}
Number.isNaN = function(value) {
return typeof value === 'number' && isNaN(value);
};
})();
// Provides support for Number.isInteger in legacy browsers.
// Support: IE.
(function checkNumberIsInteger() {
if (Number.isInteger) {
return;
}
Number.isInteger = function(value) {
return typeof value === 'number' && isFinite(value) &&
Math.floor(value) === value;
};
})();
/** /**
* Polyfill for Promises: * Polyfill for Promises:
* The following promise implementation tries to generally implement the * The following promise implementation tries to generally implement the