-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix arraybuffer polyfill to not error in ie8
- Loading branch information
1 parent
372d401
commit 95d1b47
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ samsung_mob = "<2" | |
[install] | ||
module = "js-polyfills" | ||
paths = [ "typedarray.js" ] | ||
postinstall = "update.task.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/polyfills/ArrayBuffer/polyfill.js b/polyfills/ArrayBuffer/polyfill.js | ||
index a4295ebf..4d6f1441 100644 | ||
--- a/polyfills/ArrayBuffer/polyfill.js | ||
+++ b/polyfills/ArrayBuffer/polyfill.js | ||
@@ -117,12 +117,14 @@ | ||
if (obj.length > MAX_ARRAY_LENGTH) throw RangeError('Array too large for polyfill'); | ||
|
||
function makeArrayAccessor(index) { | ||
- Object.defineProperty(obj, index, { | ||
- 'get': function() { return obj._getter(index); }, | ||
- 'set': function(v) { obj._setter(index, v); }, | ||
- enumerable: true, | ||
- configurable: false | ||
- }); | ||
+ try { | ||
+ Object.defineProperty(obj, index, { | ||
+ 'get': function() { return obj._getter(index); }, | ||
+ 'set': function(v) { obj._setter(index, v); }, | ||
+ enumerable: true, | ||
+ configurable: false | ||
+ }); | ||
+ } catch (_){ } | ||
} | ||
|
||
var i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
|
||
var fs = require('graceful-fs'); | ||
var diff = require('diff'); | ||
var process = require('process'); | ||
var path = require('path'); | ||
|
||
var polyfill = fs.readFileSync(path.join(__dirname, './polyfill.js'), 'utf8'); | ||
var patch = fs.readFileSync(path.join(__dirname, './patch.jsdiff'), 'utf8'); | ||
|
||
var patched = diff.applyPatch(polyfill, patch); | ||
|
||
if (patched === false) {process.exit(1);} | ||
fs.writeFileSync(path.join(__dirname, './polyfill.js'), patched); |