Merge pull request #705 from mmso/fix/ie11

Fix IE11 support
This commit is contained in:
Sanjana Rajan 2018-05-19 12:50:54 -07:00 committed by GitHub
commit 5111a2ba43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -15,9 +15,10 @@ if (typeof Array.prototype.find === 'undefined') {
if (typeof Array.from === 'undefined') {
require('core-js/fn/array/from');
}
if (typeof Promise === 'undefined') {
require('core-js/fn/promise');
}
// No if-statement on Promise because of IE11. Otherwise Promise is undefined in the service worker.
require('core-js/fn/promise');
if (typeof Uint8Array.from === 'undefined') {
require('core-js/fn/typed/uint8-array');
}

View File

@ -30,8 +30,9 @@ import config from './config';
import util from './util'; // re-import module to access util functions
import b64 from './encoding/base64';
export default {
const isIE11 = typeof navigator !== 'undefined' && !!navigator.userAgent.match(/Trident\/7\.0.*rv:([0-9.]+).*\).*Gecko$/);
export default {
isString: function(data) {
return typeof data === 'string' || String.prototype.isPrototypeOf(data);
},
@ -51,6 +52,10 @@ export default {
* @returns {Array<ArrayBuffer>} an array of binary data to be passed
*/
getTransferables: function(obj) {
// Internet Explorer does not support Transferable objects.
if (isIE11) {
return undefined;
}
if (config.zero_copy && Object.prototype.isPrototypeOf(obj)) {
const transferables = [];
util.collectBuffers(obj, transferables);