Skip to content

Commit

Permalink
#2289 add shim to make brotli decoding work with IE
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@22861 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 6, 2019
1 parent cacd6ab commit 98706ca
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/html5/js/lib/es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,44 @@ if (!Array.from) {
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector;
}


if (!Int32Array.__proto__.from) {
(function () {
Int32Array.__proto__.from = function (obj, func, thisObj) {

var typedArrayClass = Int32Array.__proto__;
if(typeof this !== 'function') {
throw new TypeError('# is not a constructor');
}
if (this.__proto__ !== typedArrayClass) {
throw new TypeError('this is not a typed array.');
}

func = func || function (elem) {
return elem;
};

if (typeof func !== 'function') {
throw new TypeError('specified argument is not a function');
}

obj = Object(obj);
if (!obj['length']) {
return new this(0);
}
var copy_data = [];
for(var i = 0; i < obj.length; i++) {
copy_data.push(obj[i]);
}

copy_data = copy_data.map(func, thisObj);

var typed_array = new this(copy_data.length);
for(var i = 0; i < typed_array.length; i++) {
typed_array[i] = copy_data[i];
}
return typed_array;
}
})();
}

0 comments on commit 98706ca

Please sign in to comment.