From be36c60e0f92e0eb3c44021b571cdbb90f197b92 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 14 Aug 2017 15:55:54 +0200 Subject: [PATCH] Polyfill `Uint8ClampedArray` using core-js https://github.com/zloirock/core-js --- package.json | 1 + src/shared/compatibility.js | 6 ++++++ systemjs.config.js | 1 + 3 files changed, 8 insertions(+) diff --git a/package.json b/package.json index ae2711b5d..a55ffce66 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "babel-loader": "^6.4.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", "babel-preset-es2015": "^6.24.1", + "core-js": "^2.5.0", "escodegen": "^1.8.0", "eslint": "^4.2.0", "eslint-plugin-mozilla": "^0.4.0", diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index 395b566c3..9f5551d87 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -53,6 +53,12 @@ PDFJS.compatibilityChecked = true; // Checking if the typed arrays are supported // Support: iOS<6.0 (subarray), IE<10, Android<4.0 (function checkTypedArrayCompatibility() { + if (typeof Uint8ClampedArray === 'undefined') { + // Support: IE<11 + globalScope.Uint8ClampedArray = + require('core-js/fn/typed/uint8-clamped-array'); + } + if (typeof Uint8Array !== 'undefined') { // Support: iOS<6.0 if (typeof Uint8Array.prototype.subarray === 'undefined') { diff --git a/systemjs.config.js b/systemjs.config.js index 120146573..9efcf9301 100644 --- a/systemjs.config.js +++ b/systemjs.config.js @@ -50,6 +50,7 @@ 'pdfjs-web': new URL('web', baseLocation).href, 'pdfjs-test': new URL('test', baseLocation).href, 'pdfjs-lib': new URL('src/pdf', baseLocation).href, + 'core-js': new URL('node_modules/core-js', baseLocation).href, }, meta: { '*': {